gi-gtk-3.0.11: Gtk bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.MenuShell

Contents

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

Methods

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

data MenuShellAppendMethodInfo Source #

Instances

((~) * signature (b -> m ()), MonadIO m, IsMenuShell a, IsMenuItem b) => MethodInfo * MenuShellAppendMethodInfo a signature Source # 

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

data MenuShellCancelMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m, IsMenuShell a) => MethodInfo * MenuShellCancelMethodInfo a signature Source # 

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

data MenuShellDeselectMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m, IsMenuShell a) => MethodInfo * MenuShellDeselectMethodInfo a signature Source # 

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

data MenuShellInsertMethodInfo Source #

Instances

((~) * signature (b -> Int32 -> m ()), MonadIO m, IsMenuShell a, IsWidget b) => MethodInfo * MenuShellInsertMethodInfo a signature Source # 

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

data MenuShellPrependMethodInfo Source #

Instances

((~) * signature (b -> m ()), MonadIO m, IsMenuShell a, IsWidget b) => MethodInfo * MenuShellPrependMethodInfo a signature Source # 

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

data MenuShellSelectItemMethodInfo Source #

Instances

((~) * signature (b -> m ()), MonadIO m, IsMenuShell a, IsWidget b) => MethodInfo * MenuShellSelectItemMethodInfo a signature Source # 

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

data MenuShellTakeFocusPropertyInfo Source #

Instances

AttrInfo MenuShellTakeFocusPropertyInfo Source # 
type AttrOrigin MenuShellTakeFocusPropertyInfo Source # 
type AttrLabel MenuShellTakeFocusPropertyInfo Source # 
type AttrGetType MenuShellTakeFocusPropertyInfo Source # 
type AttrBaseTypeConstraint MenuShellTakeFocusPropertyInfo Source # 
type AttrSetTypeConstraint MenuShellTakeFocusPropertyInfo Source # 
type AttrAllowedOps MenuShellTakeFocusPropertyInfo Source # 

Signals

activateCurrent

cancel

type C_MenuShellCancelCallback = Ptr () -> Ptr () -> IO () Source #

cycleFocus

deactivate

insert

type C_MenuShellInsertCallback = Ptr () -> Ptr Widget -> Int32 -> Ptr () -> IO () Source #

moveCurrent

moveSelected

selectionDone