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

Contents

Description

The MenuButton widget is used to display a popup when clicked on. This popup can be provided either as a Menu, a Popover or an abstract MenuModel.

The MenuButton widget can hold any valid child widget. That is, it can hold almost any other standard Widget. The most commonly used child is Image. If no widget is explicitely added to the MenuButton, a Image is automatically created, using an arrow image oriented according to MenuButton:direction or the generic "view-context-menu" icon if the direction is not set.

The positioning of the popup is determined by the MenuButton:direction property of the menu button.

For menus, the Widget:halign and Widget:valign properties of the menu are also taken into account. For example, when the direction is ArrowTypeDown and the horizontal alignment is AlignStart, the menu will be positioned below the button, with the starting edge (depending on the text direction) of the menu aligned with the starting edge of the button. If there is not enough space below the button, the menu is popped up above the button instead. If the alignment would move part of the menu offscreen, it is “pushed in”.

Direction = Down

  • halign = start

  • halign = center

  • halign = end

Direction = Up

  • halign = start

  • halign = center

  • halign = end

Direction = Left

  • valign = start

  • valign = center

  • valign = end

Direction = Right

  • valign = start

  • valign = center

  • valign = end

CSS nodes

GtkMenuButton has a single CSS node with name button. To differentiate it from a plain Button, it gets the .popup style class.

Synopsis

Exported types

Methods

getAlignWidget

menuButtonGetAlignWidget Source #

Arguments

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

menuButton: a MenuButton

-> m (Maybe Widget)

Returns: a Widget value or Nothing

Returns the parent Widget to use to line up with menu.

Since: 3.6

getDirection

menuButtonGetDirection Source #

Arguments

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

menuButton: a MenuButton

-> m ArrowType

Returns: a ArrowType value

Returns the direction the popup will be pointing at when popped up.

Since: 3.6

getMenuModel

menuButtonGetMenuModel Source #

Arguments

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

menuButton: a MenuButton

-> m (Maybe MenuModel)

Returns: a MenuModel or Nothing

Returns the MenuModel used to generate the popup.

Since: 3.6

getPopover

menuButtonGetPopover Source #

Arguments

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

menuButton: a MenuButton

-> m (Maybe Popover)

Returns: a Popover or Nothing

Returns the Popover that pops out of the button. If the button is not using a Popover, this function returns Nothing.

Since: 3.12

getPopup

menuButtonGetPopup Source #

Arguments

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

menuButton: a MenuButton

-> m (Maybe Menu)

Returns: a Menu or Nothing

Returns the Menu that pops out of the button. If the button does not use a Menu, this function returns Nothing.

Since: 3.6

getUsePopover

menuButtonGetUsePopover Source #

Arguments

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

menuButton: a MenuButton

-> m Bool

Returns: True if using a Popover

Returns whether a Popover or a Menu will be constructed from the menu model.

Since: 3.12

new

menuButtonNew Source #

Arguments

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

Returns: The newly created MenuButton widget

Creates a new MenuButton widget with downwards-pointing arrow as the only child. You can replace the child widget with another Widget should you wish to.

Since: 3.6

setAlignWidget

menuButtonSetAlignWidget Source #

Arguments

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

menuButton: a MenuButton

-> Maybe b

alignWidget: a Widget

-> m () 

Sets the Widget to use to line the menu with when popped up. Note that the alignWidget must contain the MenuButton itself.

Setting it to Nothing means that the menu will be aligned with the button itself.

Note that this property is only used with menus currently, and not for popovers.

Since: 3.6

setDirection

menuButtonSetDirection Source #

Arguments

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

menuButton: a MenuButton

-> ArrowType

direction: a ArrowType

-> m () 

Sets the direction in which the popup will be popped up, as well as changing the arrow’s direction. The child will not be changed to an arrow if it was customized.

If the does not fit in the available space in the given direction, GTK+ will its best to keep it inside the screen and fully visible.

If you pass ArrowTypeNone for a direction, the popup will behave as if you passed ArrowTypeDown (although you won’t see any arrows).

Since: 3.6

setMenuModel

menuButtonSetMenuModel Source #

Arguments

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

menuButton: a MenuButton

-> Maybe b

menuModel: a MenuModel

-> m () 

Sets the MenuModel from which the popup will be constructed, or Nothing to disable the button.

Depending on the value of MenuButton:use-popover, either a Menu will be created with menuNewFromModel, or a Popover with popoverNewFromModel. In either case, actions will be connected as documented for these functions.

If MenuButton:popup or MenuButton:popover are already set, their content will be lost and replaced by the newly created popup.

Since: 3.6

setPopover

menuButtonSetPopover Source #

Arguments

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

menuButton: a MenuButton

-> Maybe b

popover: a Popover

-> m () 

Sets the Popover that will be popped up when the button is clicked, or Nothing to disable the button. If MenuButton:menu-model or MenuButton:popup are set, they will be set to Nothing.

Since: 3.12

setPopup

menuButtonSetPopup Source #

Arguments

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

menuButton: a MenuButton

-> Maybe b

menu: a Menu

-> m () 

Sets the Menu that will be popped up when the button is clicked, or Nothing to disable the button. If MenuButton:menu-model or MenuButton:popover are set, they will be set to Nothing.

Since: 3.6

setUsePopover

menuButtonSetUsePopover Source #

Arguments

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

menuButton: a MenuButton

-> Bool

usePopover: True to construct a popover from the menu model

-> m () 

Sets whether to construct a Popover instead of Menu when menuButtonSetMenuModel is called. Note that this property is only consulted when a new menu model is set.

Since: 3.12

Properties

alignWidget

data MenuButtonAlignWidgetPropertyInfo Source #

Instances

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

direction

data MenuButtonDirectionPropertyInfo Source #

Instances

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

menuModel

data MenuButtonMenuModelPropertyInfo Source #

Instances

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

popover

data MenuButtonPopoverPropertyInfo Source #

Instances

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

popup

data MenuButtonPopupPropertyInfo Source #

Instances

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

setMenuButtonPopup :: (MonadIO m, IsMenuButton o, IsMenu a) => o -> a -> m () Source #

usePopover

data MenuButtonUsePopoverPropertyInfo Source #

Instances

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