gi-gtk-3.0.37: Gtk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gtk.Objects.Menu

Description

A Menu is a MenuShell that implements a drop down menu consisting of a list of MenuItem objects which can be navigated and activated by the user to perform application functions.

A Menu is most commonly dropped down by activating a MenuItem in a MenuBar or popped up by activating a MenuItem in another Menu.

A Menu can also be popped up by activating a ComboBox. Other composite widgets such as the Notebook can pop up a Menu as well.

Applications can display a Menu as a popup menu by calling the menuPopup function. The example below shows how an application can pop up a menu when the 3rd mouse button is pressed.

Connecting the popup signal handler.

C code

  // connect our handler which will popup the menu
  g_signal_connect_swapped (window, "button_press_event",
G_CALLBACK (my_popup_handler), menu);

Signal handler which displays a popup menu.

C code

static gint
my_popup_handler (GtkWidget *widget, GdkEvent *event)
{
  GtkMenu *menu;
  GdkEventButton *event_button;

  g_return_val_if_fail (widget != NULL, FALSE);
  g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
  g_return_val_if_fail (event != NULL, FALSE);

  // The "widget" is the menu that was supplied when
  // g_signal_connect_swapped() was called.
  menu = GTK_MENU (widget);

  if (event->type == GDK_BUTTON_PRESS)
    {
      event_button = (GdkEventButton *) event;
      if (event_button->button == GDK_BUTTON_SECONDARY)
        {
          gtk_menu_popup (menu, NULL, NULL, NULL, NULL,
                          event_button->button, event_button->time);
          return TRUE;
        }
    }

  return FALSE;
}

CSS nodes

plain code

menu
├── arrow.top
├── <child>
┊
├── <child>
╰── arrow.bottom

The main CSS node of GtkMenu has name menu, and there are two subnodes with name arrow, for scrolling menu arrows. These subnodes get the .top and .bottom style classes.

Synopsis

Exported types

newtype Menu Source #

Memory-managed wrapper type.

Constructors

Menu (ManagedPtr Menu) 

Instances

Instances details
Eq Menu Source # 
Instance details

Defined in GI.Gtk.Objects.Menu

Methods

(==) :: Menu -> Menu -> Bool #

(/=) :: Menu -> Menu -> Bool #

GObject Menu Source # 
Instance details

Defined in GI.Gtk.Objects.Menu

ManagedPtrNewtype Menu Source # 
Instance details

Defined in GI.Gtk.Objects.Menu

Methods

toManagedPtr :: Menu -> ManagedPtr Menu

TypedObject Menu Source # 
Instance details

Defined in GI.Gtk.Objects.Menu

Methods

glibType :: IO GType

HasParentTypes Menu Source # 
Instance details

Defined in GI.Gtk.Objects.Menu

IsGValue (Maybe Menu) Source #

Convert Menu to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.Menu

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe Menu -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe Menu)

type ParentTypes Menu Source # 
Instance details

Defined in GI.Gtk.Objects.Menu

type ParentTypes Menu = '[MenuShell, Container, Widget, Object, ImplementorIface, Buildable]

class (GObject o, IsDescendantOf Menu o) => IsMenu o Source #

Type class for types which can be safely cast to Menu, for instance with toMenu.

Instances

Instances details
(GObject o, IsDescendantOf Menu o) => IsMenu o Source # 
Instance details

Defined in GI.Gtk.Objects.Menu

toMenu :: (MonadIO m, IsMenu o) => o -> m Menu Source #

Cast to Menu, 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, activateItem, add, addAccelerator, addChild, addDeviceEvents, addEvents, addMnemonicLabel, addTickCallback, append, attach, attachToWidget, bindModel, bindProperty, bindPropertyFull, canActivateAccel, cancel, checkResize, childFocus, childGetProperty, childNotify, childNotifyByPspec, childSetProperty, childType, classPath, computeExpand, constructChild, createPangoContext, createPangoLayout, customFinished, customTagEnd, customTagStart, deactivate, deselect, destroy, destroyed, detach, deviceIsShadowed, 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, insert, 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, placeOnMonitor, popdown, popup, popupAtPointer, popupAtRect, popupAtWidget, popupForDevice, prepend, propagateDraw, queueAllocate, queueComputeExpand, queueDraw, queueDrawArea, queueDrawRegion, queueResize, queueResizeNoRedraw, realize, ref, refSink, regionIntersect, registerWindow, remove, removeAccelerator, removeMnemonicLabel, removeTickCallback, renderIcon, renderIconPixbuf, reorderChild, reparent, reposition, resetRcStyles, resetStyle, resizeChildren, runDispose, selectFirst, selectItem, sendExpose, sendFocusChange, shapeCombineRegion, show, showAll, showNow, sizeAllocate, sizeAllocateWithBaseline, sizeRequest, stealData, stealQdata, styleAttach, styleGetProperty, thawChildNotify, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unregisterWindow, unsetFocusChain, unsetStateFlags, watchClosure.

Getters

getAccelGroup, getAccelPath, getAccessible, getActionGroup, getActive, getAllocatedBaseline, getAllocatedHeight, getAllocatedSize, getAllocatedWidth, getAllocation, getAncestor, getAppPaintable, getAttachWidget, getBorderWidth, getCanDefault, getCanFocus, getChildRequisition, getChildVisible, getChildren, getClip, getClipboard, getCompositeName, getData, getDeviceEnabled, getDeviceEvents, getDirection, getDisplay, getDoubleBuffered, getEvents, getFocusChain, getFocusChild, getFocusHadjustment, getFocusOnClick, getFocusVadjustment, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHasWindow, getHexpand, getHexpandSet, getInternalChild, getMapped, getMarginBottom, getMarginEnd, getMarginLeft, getMarginRight, getMarginStart, getMarginTop, getModifierMask, getModifierStyle, getMonitor, getName, getNoShowAll, getOpacity, getPangoContext, getParent, getParentShell, getParentWindow, getPath, getPathForChild, getPointer, getPreferredHeight, getPreferredHeightAndBaselineForWidth, getPreferredHeightForWidth, getPreferredSize, getPreferredWidth, getPreferredWidthForHeight, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRequisition, getReserveToggleSize, getResizeMode, getRootWindow, getScaleFactor, getScreen, getSelectedItem, getSensitive, getSettings, getSizeRequest, getState, getStateFlags, getStyle, getStyleContext, getSupportMultidevice, getTakeFocus, getTearoffState, getTemplateChild, getTitle, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisible, getVisual, getWindow.

Setters

setAccelGroup, setAccelPath, setActive, setAllocation, setAppPaintable, setBorderWidth, setBuildableProperty, setCanDefault, setCanFocus, setChildVisible, setClip, setCompositeName, setData, setDataFull, setDeviceEnabled, setDeviceEvents, setDirection, setDoubleBuffered, setEvents, setFocusChain, setFocusChild, setFocusHadjustment, setFocusOnClick, setFocusVadjustment, setFontMap, setFontOptions, setHalign, setHasTooltip, setHasWindow, setHexpand, setHexpandSet, setMapped, setMarginBottom, setMarginEnd, setMarginLeft, setMarginRight, setMarginStart, setMarginTop, setMonitor, setName, setNoShowAll, setOpacity, setParent, setParentWindow, setProperty, setRealized, setReallocateRedraws, setReceivesDefault, setRedrawOnAllocate, setReserveToggleSize, setResizeMode, setScreen, setSensitive, setSizeRequest, setState, setStateFlags, setStyle, setSupportMultidevice, setTakeFocus, setTearoffState, setTitle, setTooltipMarkup, setTooltipText, setTooltipWindow, setValign, setVexpand, setVexpandSet, setVisible, setVisual, setWindow.

attach

menuAttach Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a, IsWidget b) 
=> a

menu: a Menu

-> b

child: a MenuItem

-> Word32

leftAttach: The column number to attach the left side of the item to

-> Word32

rightAttach: The column number to attach the right side of the item to

-> Word32

topAttach: The row number to attach the top of the item to

-> Word32

bottomAttach: The row number to attach the bottom of the item to

-> m () 

Adds a new MenuItem to a (table) menu. The number of “cells” that an item will occupy is specified by leftAttach, rightAttach, topAttach and bottomAttach. These each represent the leftmost, rightmost, uppermost and lower column and row numbers of the table. (Columns and rows are indexed from zero).

Note that this function is not related to menuDetach.

Since: 2.4

attachToWidget

menuAttachToWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a, IsWidget b) 
=> a

menu: a Menu

-> b

attachWidget: the Widget that the menu will be attached to

-> Maybe MenuDetachFunc

detacher: the user supplied callback function that will be called when the menu calls menuDetach

-> m () 

Attaches the menu to the widget and provides a callback function that will be invoked when the menu calls menuDetach during its destruction.

If the menu is attached to the widget then it will be destroyed when the widget is destroyed, as if it was a child widget. An attached menu will also move between screens correctly if the widgets moves between screens.

detach

menuDetach Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> m () 

Detaches the menu from the widget to which it had been attached. This function will call the callback function, detacher, provided when the menuAttachToWidget function was called.

getAccelGroup

menuGetAccelGroup Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> m AccelGroup

Returns: the AccelGroup associated with the menu

Gets the AccelGroup which holds global accelerators for the menu. See menuSetAccelGroup.

getAccelPath

menuGetAccelPath Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a valid Menu

-> m Text

Returns: the accelerator path set on the menu.

Retrieves the accelerator path set on the menu.

Since: 2.14

getActive

menuGetActive Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> m Widget

Returns: the MenuItem that was last selected in the menu. If a selection has not yet been made, the first menu item is selected.

Returns the selected menu item from the menu. This is used by the ComboBox.

getAttachWidget

menuGetAttachWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> m Widget

Returns: the Widget that the menu is attached to

Returns the Widget that the menu is attached to.

getForAttachWidget

menuGetForAttachWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsWidget a) 
=> a

widget: a Widget

-> m [Widget]

Returns: the list of menus attached to his widget.

Returns a list of the menus which are attached to this widget. This list is owned by GTK+ and must not be modified.

Since: 2.6

getMonitor

menuGetMonitor Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> m Int32

Returns: the number of the monitor on which the menu should be popped up or -1, if no monitor has been set

Retrieves the number of the monitor on which to show the menu.

Since: 2.14

getReserveToggleSize

menuGetReserveToggleSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> m Bool

Returns: Whether the menu reserves toggle space

Returns whether the menu reserves space for toggles and icons, regardless of their actual presence.

Since: 2.18

getTearoffState

menuGetTearoffState Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> m Bool

Returns: True if the menu is currently torn off.

Deprecated: (Since version 3.10)

Returns whether the menu is torn off. See menuSetTearoffState.

getTitle

menuGetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> m Text

Returns: the title of the menu, or Nothing if the menu has no title set on it. This string is owned by GTK+ and should not be modified or freed.

Deprecated: (Since version 3.10)

Returns the title of the menu. See menuSetTitle.

new

menuNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Menu

Returns: a new Menu

Creates a new Menu

newFromModel

menuNewFromModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuModel a) 
=> a

model: a MenuModel

-> m Menu

Returns: a new Menu

Creates a Menu and populates it with menu items and submenus according to model.

The created menu items are connected to actions found in the ApplicationWindow to which the menu belongs - typically by means of being attached to a widget (see menuAttachToWidget) that is contained within the GtkApplicationWindows widget hierarchy.

Actions can also be added using widgetInsertActionGroup on the menu's attach widget or on any of its parent widgets.

Since: 3.4

placeOnMonitor

menuPlaceOnMonitor Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a, IsMonitor b) 
=> a

menu: a Menu

-> b

monitor: the monitor to place the menu on

-> m () 

Places menu on the given monitor.

Since: 3.22

popdown

menuPopdown Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> m () 

Removes the menu from the screen.

popup

menuPopup Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a, IsWidget b, IsWidget c) 
=> a

menu: a Menu

-> Maybe b

parentMenuShell: the menu shell containing the triggering menu item, or Nothing

-> Maybe c

parentMenuItem: the menu item whose activation triggered the popup, or Nothing

-> Maybe MenuPositionFunc

func: a user supplied function used to position the menu, or Nothing

-> Word32

button: the mouse button which was pressed to initiate the event.

-> Word32

activateTime: the time at which the activation event occurred.

-> m () 

Deprecated: (Since version 3.22)Please use menuPopupAtWidget, menuPopupAtPointer. or menuPopupAtRect instead

Displays a menu and makes it available for selection.

Applications can use this function to display context-sensitive menus, and will typically supply Nothing for the parentMenuShell, parentMenuItem, func and data parameters. The default menu positioning function will position the menu at the current mouse cursor position.

The button parameter should be the mouse button pressed to initiate the menu popup. If the menu popup was initiated by something other than a mouse button press, such as a mouse button release or a keypress, button should be 0.

The activateTime parameter is used to conflict-resolve initiation of concurrent requests for mouse/keyboard grab requests. To function properly, this needs to be the timestamp of the user event (such as a mouse click or key press) that caused the initiation of the popup. Only if no such event is available, getCurrentEventTime can be used instead.

Note that this function does not work very well on GDK backends that do not have global coordinates, such as Wayland or Mir. You should probably use one of the gtk_menu_popup_at_ variants, which do not have this problem.

popupAtPointer

menuPopupAtPointer Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: the Menu to pop up

-> Maybe Event

triggerEvent: the Event that initiated this request or Nothing if it's the current event

-> m () 

Displays menu and makes it available for selection.

See gtk_menu_popup_at_widget () to pop up a menu at a widget. gtk_menu_popup_at_rect () also allows you to position a menu at an arbitrary rectangle.

menu will be positioned at the pointer associated with triggerEvent.

Properties that influence the behaviour of this function are Menu:anchor-hints, Menu:rect-anchor-dx, Menu:rect-anchor-dy, and Menu:menu-type-hint. Connect to the poppedUp signal to find out how it was actually positioned.

Since: 3.22

popupAtRect

menuPopupAtRect Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a, IsWindow b) 
=> a

menu: the Menu to pop up

-> b

rectWindow: the Window rect is relative to

-> Rectangle

rect: the Rectangle to align menu with

-> Gravity

rectAnchor: the point on rect to align with menu's anchor point

-> Gravity

menuAnchor: the point on menu to align with rect's anchor point

-> Maybe Event

triggerEvent: the Event that initiated this request or Nothing if it's the current event

-> m () 

Displays menu and makes it available for selection.

See gtk_menu_popup_at_widget () and gtk_menu_popup_at_pointer (), which handle more common cases for popping up menus.

menu will be positioned at rect, aligning their anchor points. rect is relative to the top-left corner of rectWindow. rectAnchor and menuAnchor determine anchor points on rect and menu to pin together. menu can optionally be offset by Menu:rect-anchor-dx and Menu:rect-anchor-dy.

Anchors should be specified under the assumption that the text direction is left-to-right; they will be flipped horizontally automatically if the text direction is right-to-left.

Other properties that influence the behaviour of this function are Menu:anchor-hints and Menu:menu-type-hint. Connect to the poppedUp signal to find out how it was actually positioned.

Since: 3.22

popupAtWidget

menuPopupAtWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a, IsWidget b) 
=> a

menu: the Menu to pop up

-> b

widget: the Widget to align menu with

-> Gravity

widgetAnchor: the point on widget to align with menu's anchor point

-> Gravity

menuAnchor: the point on menu to align with widget's anchor point

-> Maybe Event

triggerEvent: the Event that initiated this request or Nothing if it's the current event

-> m () 

Displays menu and makes it available for selection.

See gtk_menu_popup_at_pointer () to pop up a menu at the master pointer. gtk_menu_popup_at_rect () also allows you to position a menu at an arbitrary rectangle.

menu will be positioned at widget, aligning their anchor points. widgetAnchor and menuAnchor determine anchor points on widget and menu to pin together. menu can optionally be offset by Menu:rect-anchor-dx and Menu:rect-anchor-dy.

Anchors should be specified under the assumption that the text direction is left-to-right; they will be flipped horizontally automatically if the text direction is right-to-left.

Other properties that influence the behaviour of this function are Menu:anchor-hints and Menu:menu-type-hint. Connect to the poppedUp signal to find out how it was actually positioned.

Since: 3.22

popupForDevice

menuPopupForDevice Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a, IsDevice b, IsWidget c, IsWidget d) 
=> a

menu: a Menu

-> Maybe b

device: a Device

-> Maybe c

parentMenuShell: the menu shell containing the triggering menu item, or Nothing

-> Maybe d

parentMenuItem: the menu item whose activation triggered the popup, or Nothing

-> Maybe MenuPositionFunc

func: a user supplied function used to position the menu, or Nothing

-> Word32

button: the mouse button which was pressed to initiate the event

-> Word32

activateTime: the time at which the activation event occurred

-> m () 

Deprecated: (Since version 3.22)Please use menuPopupAtWidget, menuPopupAtPointer. or menuPopupAtRect instead

Displays a menu and makes it available for selection.

Applications can use this function to display context-sensitive menus, and will typically supply Nothing for the parentMenuShell, parentMenuItem, func, data and destroy parameters. The default menu positioning function will position the menu at the current position of device (or its corresponding pointer).

The button parameter should be the mouse button pressed to initiate the menu popup. If the menu popup was initiated by something other than a mouse button press, such as a mouse button release or a keypress, button should be 0.

The activateTime parameter is used to conflict-resolve initiation of concurrent requests for mouse/keyboard grab requests. To function properly, this needs to be the time stamp of the user event (such as a mouse click or key press) that caused the initiation of the popup. Only if no such event is available, getCurrentEventTime can be used instead.

Note that this function does not work very well on GDK backends that do not have global coordinates, such as Wayland or Mir. You should probably use one of the gtk_menu_popup_at_ variants, which do not have this problem.

Since: 3.0

reorderChild

menuReorderChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a, IsWidget b) 
=> a

menu: a Menu

-> b

child: the MenuItem to move

-> Int32

position: the new position to place child. Positions are numbered from 0 to n - 1

-> m () 

Moves child to a new position in the list of menu children.

reposition

menuReposition Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> m () 

Repositions the menu according to its position function.

setAccelGroup

menuSetAccelGroup Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a, IsAccelGroup b) 
=> a

menu: a Menu

-> Maybe b

accelGroup: the AccelGroup to be associated with the menu.

-> m () 

Set the AccelGroup which holds global accelerators for the menu. This accelerator group needs to also be added to all windows that this menu is being used in with windowAddAccelGroup, in order for those windows to support all the accelerators contained in this group.

setAccelPath

menuSetAccelPath Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a valid Menu

-> Maybe Text

accelPath: a valid accelerator path, or Nothing to unset the path

-> m () 

Sets an accelerator path for this menu from which accelerator paths for its immediate children, its menu items, can be constructed. The main purpose of this function is to spare the programmer the inconvenience of having to call menuItemSetAccelPath on each menu item that should support runtime user changable accelerators. Instead, by just calling menuSetAccelPath on their parent, each menu item of this menu, that contains a label describing its purpose, automatically gets an accel path assigned.

For example, a menu containing menu items “New” and “Exit”, will, after gtk_menu_set_accel_path (menu, "<Gnumeric-Sheet>/File"); has been called, assign its items the accel paths: "<Gnumeric-Sheet>/File/New" and "<Gnumeric-Sheet>/File/Exit".

Assigning accel paths to menu items then enables the user to change their accelerators at runtime. More details about accelerator paths and their default setups can be found at accelMapAddEntry.

Note that accelPath string will be stored in a GQuark. Therefore, if you pass a static string, you can save some memory by interning it first with internStaticString.

setActive

menuSetActive Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> Word32

index: the index of the menu item to select. Index values are from 0 to n-1

-> m () 

Selects the specified menu item within the menu. This is used by the ComboBox and should not be used by anyone else.

setMonitor

menuSetMonitor Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> Int32

monitorNum: the number of the monitor on which the menu should be popped up

-> m () 

Informs GTK+ on which monitor a menu should be popped up. See monitorGetGeometry.

This function should be called from a MenuPositionFunc if the menu should not appear on the same monitor as the pointer. This information can’t be reliably inferred from the coordinates returned by a MenuPositionFunc, since, for very long menus, these coordinates may extend beyond the monitor boundaries or even the screen boundaries.

Since: 2.4

setReserveToggleSize

menuSetReserveToggleSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> Bool

reserveToggleSize: whether to reserve size for toggles

-> m () 

Sets whether the menu should reserve space for drawing toggles or icons, regardless of their actual presence.

Since: 2.18

setScreen

menuSetScreen Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a, IsScreen b) 
=> a

menu: a Menu

-> Maybe b

screen: a Screen, or Nothing if the screen should be determined by the widget the menu is attached to

-> m () 

Sets the Screen on which the menu will be displayed.

Since: 2.2

setTearoffState

menuSetTearoffState Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> Bool

tornOff: If True, menu is displayed as a tearoff menu.

-> m () 

Deprecated: (Since version 3.10)

Changes the tearoff state of the menu. A menu is normally displayed as drop down menu which persists as long as the menu is active. It can also be displayed as a tearoff menu which persists until it is closed or reattached.

setTitle

menuSetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenu a) 
=> a

menu: a Menu

-> Maybe Text

title: a string containing the title for the menu, or Nothing to inherit the title of the parent menu item, if any

-> m () 

Deprecated: (Since version 3.10)

Sets the title string for the menu.

The title is displayed when the menu is shown as a tearoff menu. If title is Nothing, the menu will see if it is attached to a parent menu item, and if so it will try to use the same text as that menu item’s label.

Properties

accelGroup

The accel group holding accelerators for the menu.

Since: 2.14

clearMenuAccelGroup :: (MonadIO m, IsMenu o) => o -> m () Source #

Set the value of the “accel-group” property to Nothing. When overloading is enabled, this is equivalent to

clear #accelGroup

constructMenuAccelGroup :: (IsMenu o, MonadIO m, IsAccelGroup a) => a -> m (GValueConstruct o) Source #

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

getMenuAccelGroup :: (MonadIO m, IsMenu o) => o -> m AccelGroup Source #

Get the value of the “accel-group” property. When overloading is enabled, this is equivalent to

get menu #accelGroup

setMenuAccelGroup :: (MonadIO m, IsMenu o, IsAccelGroup a) => o -> a -> m () Source #

Set the value of the “accel-group” property. When overloading is enabled, this is equivalent to

set menu [ #accelGroup := value ]

accelPath

An accel path used to conveniently construct accel paths of child items.

Since: 2.14

clearMenuAccelPath :: (MonadIO m, IsMenu o) => o -> m () Source #

Set the value of the “accel-path” property to Nothing. When overloading is enabled, this is equivalent to

clear #accelPath

constructMenuAccelPath :: (IsMenu o, MonadIO m) => Text -> m (GValueConstruct o) Source #

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

getMenuAccelPath :: (MonadIO m, IsMenu o) => o -> m Text Source #

Get the value of the “accel-path” property. When overloading is enabled, this is equivalent to

get menu #accelPath

setMenuAccelPath :: (MonadIO m, IsMenu o) => o -> Text -> m () Source #

Set the value of the “accel-path” property. When overloading is enabled, this is equivalent to

set menu [ #accelPath := value ]

active

The index of the currently selected menu item, or -1 if no menu item is selected.

Since: 2.14

constructMenuActive :: (IsMenu o, MonadIO m) => Int32 -> 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.

getMenuActive :: (MonadIO m, IsMenu o) => o -> m Int32 Source #

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

get menu #active

setMenuActive :: (MonadIO m, IsMenu o) => o -> Int32 -> m () Source #

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

set menu [ #active := value ]

anchorHints

Positioning hints for aligning the menu relative to a rectangle.

These hints determine how the menu should be positioned in the case that the menu would fall off-screen if placed in its ideal position.

For example, AnchorHintsFlipY will replace GravityNorthWest with GravitySouthWest and vice versa if the menu extends beyond the bottom edge of the monitor.

See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), gtk_menu_popup_at_pointer (), Menu:rect-anchor-dx, Menu:rect-anchor-dy, Menu:menu-type-hint, and poppedUp.

Since: 3.22

constructMenuAnchorHints :: (IsMenu o, MonadIO m) => [AnchorHints] -> m (GValueConstruct o) Source #

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

getMenuAnchorHints :: (MonadIO m, IsMenu o) => o -> m [AnchorHints] Source #

Get the value of the “anchor-hints” property. When overloading is enabled, this is equivalent to

get menu #anchorHints

setMenuAnchorHints :: (MonadIO m, IsMenu o) => o -> [AnchorHints] -> m () Source #

Set the value of the “anchor-hints” property. When overloading is enabled, this is equivalent to

set menu [ #anchorHints := value ]

attachWidget

The widget the menu is attached to. Setting this property attaches the menu without a MenuDetachFunc. If you need to use a detacher, use menuAttachToWidget directly.

Since: 2.14

clearMenuAttachWidget :: (MonadIO m, IsMenu o) => o -> m () Source #

Set the value of the “attach-widget” property to Nothing. When overloading is enabled, this is equivalent to

clear #attachWidget

constructMenuAttachWidget :: (IsMenu o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #

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

getMenuAttachWidget :: (MonadIO m, IsMenu o) => o -> m Widget Source #

Get the value of the “attach-widget” property. When overloading is enabled, this is equivalent to

get menu #attachWidget

setMenuAttachWidget :: (MonadIO m, IsMenu o, IsWidget a) => o -> a -> m () Source #

Set the value of the “attach-widget” property. When overloading is enabled, this is equivalent to

set menu [ #attachWidget := value ]

menuTypeHint

The WindowTypeHint to use for the menu's Window.

See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), gtk_menu_popup_at_pointer (), Menu:anchor-hints, Menu:rect-anchor-dx, Menu:rect-anchor-dy, and poppedUp.

Since: 3.22

constructMenuMenuTypeHint :: (IsMenu o, MonadIO m) => WindowTypeHint -> m (GValueConstruct o) Source #

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

getMenuMenuTypeHint :: (MonadIO m, IsMenu o) => o -> m WindowTypeHint Source #

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

get menu #menuTypeHint

setMenuMenuTypeHint :: (MonadIO m, IsMenu o) => o -> WindowTypeHint -> m () Source #

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

set menu [ #menuTypeHint := value ]

monitor

The monitor the menu will be popped up on.

Since: 2.14

constructMenuMonitor :: (IsMenu o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

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

getMenuMonitor :: (MonadIO m, IsMenu o) => o -> m Int32 Source #

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

get menu #monitor

setMenuMonitor :: (MonadIO m, IsMenu o) => o -> Int32 -> m () Source #

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

set menu [ #monitor := value ]

rectAnchorDx

Horizontal offset to apply to the menu, i.e. the rectangle or widget anchor.

See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), gtk_menu_popup_at_pointer (), Menu:anchor-hints, Menu:rect-anchor-dy, Menu:menu-type-hint, and poppedUp.

Since: 3.22

constructMenuRectAnchorDx :: (IsMenu o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

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

getMenuRectAnchorDx :: (MonadIO m, IsMenu o) => o -> m Int32 Source #

Get the value of the “rect-anchor-dx” property. When overloading is enabled, this is equivalent to

get menu #rectAnchorDx

setMenuRectAnchorDx :: (MonadIO m, IsMenu o) => o -> Int32 -> m () Source #

Set the value of the “rect-anchor-dx” property. When overloading is enabled, this is equivalent to

set menu [ #rectAnchorDx := value ]

rectAnchorDy

Vertical offset to apply to the menu, i.e. the rectangle or widget anchor.

See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), gtk_menu_popup_at_pointer (), Menu:anchor-hints, Menu:rect-anchor-dx, Menu:menu-type-hint, and poppedUp.

Since: 3.22

constructMenuRectAnchorDy :: (IsMenu o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

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

getMenuRectAnchorDy :: (MonadIO m, IsMenu o) => o -> m Int32 Source #

Get the value of the “rect-anchor-dy” property. When overloading is enabled, this is equivalent to

get menu #rectAnchorDy

setMenuRectAnchorDy :: (MonadIO m, IsMenu o) => o -> Int32 -> m () Source #

Set the value of the “rect-anchor-dy” property. When overloading is enabled, this is equivalent to

set menu [ #rectAnchorDy := value ]

reserveToggleSize

A boolean that indicates whether the menu reserves space for toggles and icons, regardless of their actual presence.

This property should only be changed from its default value for special-purposes such as tabular menus. Regular menus that are connected to a menu bar or context menus should reserve toggle space for consistency.

Since: 2.18

constructMenuReserveToggleSize :: (IsMenu o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getMenuReserveToggleSize :: (MonadIO m, IsMenu o) => o -> m Bool Source #

Get the value of the “reserve-toggle-size” property. When overloading is enabled, this is equivalent to

get menu #reserveToggleSize

setMenuReserveToggleSize :: (MonadIO m, IsMenu o) => o -> Bool -> m () Source #

Set the value of the “reserve-toggle-size” property. When overloading is enabled, this is equivalent to

set menu [ #reserveToggleSize := value ]

tearoffState

A boolean that indicates whether the menu is torn-off.

Since: 2.6

constructMenuTearoffState :: (IsMenu o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getMenuTearoffState :: (MonadIO m, IsMenu o) => o -> m Bool Source #

Get the value of the “tearoff-state” property. When overloading is enabled, this is equivalent to

get menu #tearoffState

setMenuTearoffState :: (MonadIO m, IsMenu o) => o -> Bool -> m () Source #

Set the value of the “tearoff-state” property. When overloading is enabled, this is equivalent to

set menu [ #tearoffState := value ]

tearoffTitle

A title that may be displayed by the window manager when this menu is torn-off.

clearMenuTearoffTitle :: (MonadIO m, IsMenu o) => o -> m () Source #

Set the value of the “tearoff-title” property to Nothing. When overloading is enabled, this is equivalent to

clear #tearoffTitle

constructMenuTearoffTitle :: (IsMenu o, MonadIO m) => Text -> m (GValueConstruct o) Source #

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

getMenuTearoffTitle :: (MonadIO m, IsMenu o) => o -> m (Maybe Text) Source #

Get the value of the “tearoff-title” property. When overloading is enabled, this is equivalent to

get menu #tearoffTitle

setMenuTearoffTitle :: (MonadIO m, IsMenu o) => o -> Text -> m () Source #

Set the value of the “tearoff-title” property. When overloading is enabled, this is equivalent to

set menu [ #tearoffTitle := value ]

Signals

moveScroll

type C_MenuMoveScrollCallback = Ptr () -> CUInt -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type MenuMoveScrollCallback Source #

Arguments

 = ScrollType

scrollType: a ScrollType

-> IO () 

No description available in the introspection data.

afterMenuMoveScroll :: (IsMenu a, MonadIO m) => a -> MenuMoveScrollCallback -> m SignalHandlerId Source #

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

after menu #moveScroll callback

genClosure_MenuMoveScroll :: MonadIO m => MenuMoveScrollCallback -> m (GClosure C_MenuMoveScrollCallback) Source #

Wrap the callback into a GClosure.

onMenuMoveScroll :: (IsMenu a, MonadIO m) => a -> MenuMoveScrollCallback -> m SignalHandlerId Source #

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

on menu #moveScroll callback

poppedUp

type C_MenuPoppedUpCallback = Ptr () -> Ptr () -> Ptr () -> CInt -> CInt -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type MenuPoppedUpCallback Source #

Arguments

 = Ptr ()

flippedRect: the position of menu after any possible flipping or Nothing if the backend can't obtain it

-> Ptr ()

finalRect: the final position of menu or Nothing if the backend can't obtain it

-> Bool

flippedX: True if the anchors were flipped horizontally

-> Bool

flippedY: True if the anchors were flipped vertically

-> IO () 

Emitted when the position of menu is finalized after being popped up using gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), or gtk_menu_popup_at_pointer ().

menu might be flipped over the anchor rectangle in order to keep it on-screen, in which case flippedX and flippedY will be set to True accordingly.

flippedRect is the ideal position of menu after any possible flipping, but before any possible sliding. finalRect is flippedRect, but possibly translated in the case that flipping is still ineffective in keeping menu on-screen.

The blue menu is menu's ideal position, the green menu is flippedRect, and the red menu is finalRect.

See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), gtk_menu_popup_at_pointer (), Menu:anchor-hints, Menu:rect-anchor-dx, Menu:rect-anchor-dy, and Menu:menu-type-hint.

Since: 3.22

afterMenuPoppedUp :: (IsMenu a, MonadIO m) => a -> MenuPoppedUpCallback -> m SignalHandlerId Source #

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

after menu #poppedUp callback

genClosure_MenuPoppedUp :: MonadIO m => MenuPoppedUpCallback -> m (GClosure C_MenuPoppedUpCallback) Source #

Wrap the callback into a GClosure.

mk_MenuPoppedUpCallback :: C_MenuPoppedUpCallback -> IO (FunPtr C_MenuPoppedUpCallback) Source #

Generate a function pointer callable from C code, from a C_MenuPoppedUpCallback.

onMenuPoppedUp :: (IsMenu a, MonadIO m) => a -> MenuPoppedUpCallback -> m SignalHandlerId Source #

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

on menu #poppedUp callback