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

GI.Gtk.Objects.MenuShell

Description

A MenuShell is the abstract base class used to derive the Menu and MenuBar subclasses.

A MenuShell is a container of MenuItem objects arranged in a list which can be navigated, selected, and activated by the user to perform application functions. A MenuItem can have a submenu associated with it, allowing for nested hierarchical menus.

Terminology

A menu item can be “selected”, this means that it is displayed in the prelight state, and if it has a submenu, that submenu will be popped up.

A menu is “active” when it is visible onscreen and the user is selecting from it. A menubar is not active until the user clicks on one of its menuitems. When a menu is active, passing the mouse over a submenu will pop it up.

There is also is a concept of the current menu and a current menu item. The current menu item is the selected menu item that is furthest down in the hierarchy. (Every active menu shell does not necessarily contain a selected menu item, but if it does, then the parent menu shell must also contain a selected menu item.) The current menu is the menu that contains the current menu item. It will always have a GTK grab and receive all key presses.

Synopsis

Exported types

newtype MenuShell Source #

Memory-managed wrapper type.

Constructors

MenuShell (ManagedPtr MenuShell) 

Instances

Instances details
Eq MenuShell Source # 
Instance details

Defined in GI.Gtk.Objects.MenuShell

GObject MenuShell Source # 
Instance details

Defined in GI.Gtk.Objects.MenuShell

ManagedPtrNewtype MenuShell Source # 
Instance details

Defined in GI.Gtk.Objects.MenuShell

Methods

toManagedPtr :: MenuShell -> ManagedPtr MenuShell

TypedObject MenuShell Source # 
Instance details

Defined in GI.Gtk.Objects.MenuShell

Methods

glibType :: IO GType

HasParentTypes MenuShell Source # 
Instance details

Defined in GI.Gtk.Objects.MenuShell

IsGValue (Maybe MenuShell) Source #

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

Instance details

Defined in GI.Gtk.Objects.MenuShell

Methods

gvalueGType_ :: IO GType

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

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

type ParentTypes MenuShell Source # 
Instance details

Defined in GI.Gtk.Objects.MenuShell

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

class (GObject o, IsDescendantOf MenuShell o) => IsMenuShell o Source #

Type class for types which can be safely cast to MenuShell, for instance with toMenuShell.

Instances

Instances details
(GObject o, IsDescendantOf MenuShell o) => IsMenuShell o Source # 
Instance details

Defined in GI.Gtk.Objects.MenuShell

toMenuShell :: (MonadIO m, IsMenuShell o) => o -> m MenuShell Source #

Cast to MenuShell, 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, bindModel, bindProperty, bindPropertyFull, canActivateAccel, cancel, checkResize, childFocus, childGetProperty, childNotify, childNotifyByPspec, childSetProperty, childType, classPath, computeExpand, constructChild, createPangoContext, createPangoLayout, customFinished, customTagEnd, customTagStart, deactivate, deselect, destroy, destroyed, 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, prepend, propagateDraw, queueAllocate, queueComputeExpand, queueDraw, queueDrawArea, queueDrawRegion, queueResize, queueResizeNoRedraw, realize, ref, refSink, regionIntersect, registerWindow, remove, removeAccelerator, removeMnemonicLabel, removeTickCallback, renderIcon, renderIconPixbuf, reparent, 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

getAccessible, getActionGroup, getAllocatedBaseline, getAllocatedHeight, getAllocatedSize, getAllocatedWidth, getAllocation, getAncestor, getAppPaintable, 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, getName, getNoShowAll, getOpacity, getPangoContext, getParent, getParentShell, getParentWindow, getPath, getPathForChild, getPointer, getPreferredHeight, getPreferredHeightAndBaselineForWidth, getPreferredHeightForWidth, getPreferredSize, getPreferredWidth, getPreferredWidthForHeight, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRequisition, getResizeMode, getRootWindow, getScaleFactor, getScreen, getSelectedItem, getSensitive, getSettings, getSizeRequest, getState, getStateFlags, getStyle, getStyleContext, getSupportMultidevice, getTakeFocus, getTemplateChild, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisible, getVisual, getWindow.

Setters

setAccelPath, 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, setName, setNoShowAll, setOpacity, setParent, setParentWindow, setProperty, setRealized, setReallocateRedraws, setReceivesDefault, setRedrawOnAllocate, setResizeMode, setSensitive, setSizeRequest, setState, setStateFlags, setStyle, setSupportMultidevice, setTakeFocus, setTooltipMarkup, setTooltipText, setTooltipWindow, setValign, setVexpand, setVexpandSet, setVisible, setVisual, setWindow.

activateItem

menuShellActivateItem Source #

Arguments

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

menuShell: a MenuShell

-> b

menuItem: the MenuItem to activate

-> Bool

forceDeactivate: if True, force the deactivation of the menu shell after the menu item is activated

-> m () 

Activates the menu item within the menu shell.

append

menuShellAppend Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuShell a, IsMenuItem b) 
=> a

menuShell: a MenuShell

-> b

child: The MenuItem to add

-> m () 

Adds a new MenuItem to the end of the menu shell's item list.

bindModel

menuShellBindModel Source #

Arguments

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

menuShell: a MenuShell

-> Maybe b

model: the MenuModel to bind to or Nothing to remove binding

-> Maybe Text

actionNamespace: the namespace for actions in model

-> Bool

withSeparators: True if toplevel items in shell should have separators between them

-> m () 

Establishes a binding between a MenuShell and a MenuModel.

The contents of shell are removed and then refilled with menu items according to model. When model changes, shell is updated. Calling this function twice on shell with different model will cause the first binding to be replaced with a binding to the new model. If model is Nothing then any previous binding is undone and all children are removed.

withSeparators determines if toplevel items (eg: sections) have separators inserted between them. This is typically desired for menus but doesn’t make sense for menubars.

If actionNamespace is non-Nothing then the effect is as if all actions mentioned in the model have their names prefixed with the namespace, plus a dot. For example, if the action “quit” is mentioned and actionNamespace is “app” then the effective action name is “app.quit”.

This function uses Actionable to define the action name and target values on the created menu items. If you want to use an action group other than “app” and “win”, or if you want to use a MenuShell outside of a ApplicationWindow, then you will need to attach your own action group to the widget hierarchy using widgetInsertActionGroup. As an example, if you created a group with a “quit” action and inserted it with the name “mygroup” then you would use the action name “mygroup.quit” in your MenuModel.

For most cases you are probably better off using menuNewFromModel or menuBarNewFromModel or just directly passing the MenuModel to applicationSetAppMenu or applicationSetMenubar.

Since: 3.6

cancel

menuShellCancel Source #

Arguments

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

menuShell: a MenuShell

-> m () 

Cancels the selection within the menu shell.

Since: 2.4

deactivate

menuShellDeactivate Source #

Arguments

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

menuShell: a MenuShell

-> m () 

Deactivates the menu shell.

Typically this results in the menu shell being erased from the screen.

deselect

menuShellDeselect Source #

Arguments

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

menuShell: a MenuShell

-> m () 

Deselects the currently selected item from the menu shell, if any.

getParentShell

menuShellGetParentShell Source #

Arguments

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

menuShell: a MenuShell

-> m Widget

Returns: the parent MenuShell

Gets the parent menu shell.

The parent menu shell of a submenu is the Menu or MenuBar from which it was opened up.

Since: 3.0

getSelectedItem

menuShellGetSelectedItem Source #

Arguments

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

menuShell: a MenuShell

-> m Widget

Returns: the currently selected item

Gets the currently selected item.

Since: 3.0

getTakeFocus

menuShellGetTakeFocus Source #

Arguments

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

menuShell: a MenuShell

-> m Bool

Returns: True if the menu shell will take the keyboard focus on popup.

Returns True if the menu shell will take the keyboard focus on popup.

Since: 2.8

insert

menuShellInsert Source #

Arguments

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

menuShell: a MenuShell

-> b

child: The MenuItem to add

-> Int32

position: The position in the item list where child is added. Positions are numbered from 0 to n-1

-> m () 

Adds a new MenuItem to the menu shell’s item list at the position indicated by position.

prepend

menuShellPrepend Source #

Arguments

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

menuShell: a MenuShell

-> b

child: The MenuItem to add

-> m () 

Adds a new MenuItem to the beginning of the menu shell's item list.

selectFirst

menuShellSelectFirst Source #

Arguments

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

menuShell: a MenuShell

-> Bool

searchSensitive: if True, search for the first selectable menu item, otherwise select nothing if the first item isn’t sensitive. This should be False if the menu is being popped up initially.

-> m () 

Select the first visible or selectable child of the menu shell; don’t select tearoff items unless the only item is a tearoff item.

Since: 2.2

selectItem

menuShellSelectItem Source #

Arguments

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

menuShell: a MenuShell

-> b

menuItem: The MenuItem to select

-> m () 

Selects the menu item from the menu shell.

setTakeFocus

menuShellSetTakeFocus Source #

Arguments

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

menuShell: a MenuShell

-> Bool

takeFocus: True if the menu shell should take the keyboard focus on popup

-> m () 

If takeFocus is True (the default) the menu shell will take the keyboard focus so that it will receive all keyboard events which is needed to enable keyboard navigation in menus.

Setting takeFocus to False is useful only for special applications like virtual keyboard implementations which should not take keyboard focus.

The takeFocus state of a menu or menu bar is automatically propagated to submenus whenever a submenu is popped up, so you don’t have to worry about recursively setting it for your entire menu hierarchy. Only when programmatically picking a submenu and popping it up manually, the takeFocus property of the submenu needs to be set explicitly.

Note that setting it to False has side-effects:

If the focus is in some other app, it keeps the focus and keynav in the menu doesn’t work. Consequently, keynav on the menu will only work if the focus is on some toplevel owned by the onscreen keyboard.

To avoid confusing the user, menus with takeFocus set to False should not display mnemonics or accelerators, since it cannot be guaranteed that they will work.

See also keyboardGrab

Since: 2.8

Properties

takeFocus

A boolean that determines whether the menu and its submenus grab the keyboard focus. See menuShellSetTakeFocus and menuShellGetTakeFocus.

Since: 2.8

constructMenuShellTakeFocus :: (IsMenuShell o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getMenuShellTakeFocus :: (MonadIO m, IsMenuShell o) => o -> m Bool Source #

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

get menuShell #takeFocus

setMenuShellTakeFocus :: (MonadIO m, IsMenuShell o) => o -> Bool -> m () Source #

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

set menuShell [ #takeFocus := value ]

Signals

activateCurrent

type MenuShellActivateCurrentCallback Source #

Arguments

 = Bool

forceHide: if True, hide the menu after activating the menu item

-> IO () 

An action signal that activates the current menu item within the menu shell.

afterMenuShellActivateCurrent :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellActivateCurrentCallback) -> m SignalHandlerId Source #

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

after menuShell #activateCurrent 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.

onMenuShellActivateCurrent :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellActivateCurrentCallback) -> m SignalHandlerId Source #

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

on menuShell #activateCurrent callback

cancel

type MenuShellCancelCallback = IO () Source #

An action signal which cancels the selection within the menu shell. Causes the MenuShell::selectionDone signal to be emitted.

afterMenuShellCancel :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellCancelCallback) -> m SignalHandlerId Source #

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

after menuShell #cancel 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.

onMenuShellCancel :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellCancelCallback) -> m SignalHandlerId Source #

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

on menuShell #cancel callback

cycleFocus

type MenuShellCycleFocusCallback Source #

Arguments

 = DirectionType

direction: the direction to cycle in

-> IO () 

A keybinding signal which moves the focus in the given direction.

afterMenuShellCycleFocus :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellCycleFocusCallback) -> m SignalHandlerId Source #

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

after menuShell #cycleFocus 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.

onMenuShellCycleFocus :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellCycleFocusCallback) -> m SignalHandlerId Source #

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

on menuShell #cycleFocus callback

deactivate

type MenuShellDeactivateCallback = IO () Source #

This signal is emitted when a menu shell is deactivated.

afterMenuShellDeactivate :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellDeactivateCallback) -> m SignalHandlerId Source #

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

after menuShell #deactivate 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.

onMenuShellDeactivate :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellDeactivateCallback) -> m SignalHandlerId Source #

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

on menuShell #deactivate callback

insert

type MenuShellInsertCallback Source #

Arguments

 = Widget

child: the MenuItem that is being inserted

-> Int32

position: the position at which the insert occurs

-> IO () 

The insert signal is emitted when a new MenuItem is added to a MenuShell. A separate signal is used instead of GtkContaineradd because of the need for an additional position parameter.

The inverse of this signal is the GtkContainerremoved signal.

Since: 3.2

afterMenuShellInsert :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellInsertCallback) -> m SignalHandlerId Source #

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

after menuShell #insert 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.

onMenuShellInsert :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellInsertCallback) -> m SignalHandlerId Source #

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

on menuShell #insert callback

moveCurrent

type MenuShellMoveCurrentCallback Source #

Arguments

 = MenuDirectionType

direction: the direction to move

-> IO () 

An keybinding signal which moves the current menu item in the direction specified by direction.

afterMenuShellMoveCurrent :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellMoveCurrentCallback) -> m SignalHandlerId Source #

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

after menuShell #moveCurrent 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.

onMenuShellMoveCurrent :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellMoveCurrentCallback) -> m SignalHandlerId Source #

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

on menuShell #moveCurrent callback

moveSelected

type MenuShellMoveSelectedCallback Source #

Arguments

 = Int32

distance: +1 to move to the next item, -1 to move to the previous

-> IO Bool

Returns: True to stop the signal emission, False to continue

The moveSelected signal is emitted to move the selection to another item.

Since: 2.12

afterMenuShellMoveSelected :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellMoveSelectedCallback) -> m SignalHandlerId Source #

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

after menuShell #moveSelected 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.

onMenuShellMoveSelected :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellMoveSelectedCallback) -> m SignalHandlerId Source #

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

on menuShell #moveSelected callback

selectionDone

type MenuShellSelectionDoneCallback = IO () Source #

This signal is emitted when a selection has been completed within a menu shell.

afterMenuShellSelectionDone :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellSelectionDoneCallback) -> m SignalHandlerId Source #

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

after menuShell #selectionDone 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.

onMenuShellSelectionDone :: (IsMenuShell a, MonadIO m) => a -> ((?self :: a) => MenuShellSelectionDoneCallback) -> m SignalHandlerId Source #

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

on menuShell #selectionDone callback