gi-gtk-3.0.32: Gtk bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.MenuButton

Contents

Description

The tMenuButton widget is used to display a popup when clicked on. This popup can be provided either as a tMenu, a tPopover or an abstract tMenuModel.

The tMenuButton widget can hold any valid child widget. That is, it can hold almost any other standard tWidget. The most commonly used child is tImage. If no widget is explicitely added to the tMenuButton, a tImage is automatically created, using an arrow image oriented according to tMenuButton:direction or the generic “open-menu-symbolic” icon if the direction is not set.

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

For menus, the tWidget:halign and tWidget: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 tButton, it gets the .popup style class.

Synopsis

Exported types

newtype MenuButton Source #

Memory-managed wrapper type.

Constructors

MenuButton (ManagedPtr MenuButton) 
Instances
Eq MenuButton Source # 
Instance details

Defined in GI.Gtk.Objects.MenuButton

Methods

(==) :: MenuButton -> MenuButton -> Bool

(/=) :: MenuButton -> MenuButton -> Bool

GObject MenuButton Source # 
Instance details

Defined in GI.Gtk.Objects.MenuButton

Methods

gobjectType :: IO GType

IsGValue MenuButton Source #

Convert MenuButton to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.MenuButton

Methods

toGValue :: MenuButton -> IO GValue

fromGValue :: GValue -> IO MenuButton

HasParentTypes MenuButton Source # 
Instance details

Defined in GI.Gtk.Objects.MenuButton

type ParentTypes MenuButton Source # 
Instance details

Defined in GI.Gtk.Objects.MenuButton

type ParentTypes MenuButton = ToggleButton ': (Button ': (Bin ': (Container ': (Widget ': (Object ': (ImplementorIface ': (Actionable ': (Activatable ': (Buildable ': ([] :: [Type]))))))))))

class (GObject o, IsDescendantOf MenuButton o) => IsMenuButton o Source #

Type class for types which can be safely cast to MenuButton, for instance with toMenuButton.

Instances
(GObject o, IsDescendantOf MenuButton o) => IsMenuButton o Source # 
Instance details

Defined in GI.Gtk.Objects.MenuButton

toMenuButton :: (MonadIO m, IsMenuButton o) => o -> m MenuButton Source #

Cast to MenuButton, for types for which this is known to be safe. For general casts, use castTo.

noMenuButton :: Maybe MenuButton Source #

A convenience alias for Nothing :: Maybe MenuButton.

Methods

Overloaded methods

getAlignWidget

menuButtonGetAlignWidget Source #

Arguments

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

menuButton: a tMenuButton

-> m (Maybe Widget)

Returns: a tWidget value or Nothing

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

Since: 3.6

getDirection

menuButtonGetDirection Source #

Arguments

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

menuButton: a tMenuButton

-> m ArrowType

Returns: a tArrowType 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 tMenuButton

-> m (Maybe MenuModel)

Returns: a tMenuModel or Nothing

Returns the tMenuModel used to generate the popup.

Since: 3.6

getPopover

menuButtonGetPopover Source #

Arguments

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

menuButton: a tMenuButton

-> m (Maybe Popover)

Returns: a tPopover or Nothing

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

Since: 3.12

getPopup

menuButtonGetPopup Source #

Arguments

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

menuButton: a tMenuButton

-> m (Maybe Menu)

Returns: a tMenu or Nothing

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

Since: 3.6

getUsePopover

menuButtonGetUsePopover Source #

Arguments

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

menuButton: a tMenuButton

-> m Bool

Returns: True if using a tPopover

Returns whether a tPopover or a tMenu will be constructed from the menu model.

Since: 3.12

new

menuButtonNew Source #

Arguments

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

Returns: The newly created tMenuButton widget

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

Since: 3.6

setAlignWidget

menuButtonSetAlignWidget Source #

Arguments

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

menuButton: a tMenuButton

-> Maybe b

alignWidget: a tWidget

-> m () 

Sets the tWidget to use to line the menu with when popped up. Note that the alignWidget must contain the tMenuButton 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 tMenuButton

-> ArrowType

direction: a tArrowType

-> 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 tMenuButton

-> Maybe b

menuModel: a tMenuModel, or Nothing to unset and disable the button

-> m () 

Sets the tMenuModel from which the popup will be constructed, or Nothing to dissociate any existing menu model and disable the button.

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

If tMenuButton:popup or tMenuButton:popover are already set, those widgets are dissociated from the menuButton, and those properties are set to Nothing.

Since: 3.6

setPopover

menuButtonSetPopover Source #

Arguments

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

menuButton: a tMenuButton

-> Maybe b

popover: a tPopover, or Nothing to unset and disable the button

-> m () 

Sets the tPopover that will be popped up when the menuButton is clicked, or Nothing to dissociate any existing popover and disable the button.

If tMenuButton:menu-model or tMenuButton:popup are set, those objects are dissociated from the menuButton, and those properties are set to Nothing.

Since: 3.12

setPopup

menuButtonSetPopup Source #

Arguments

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

menuButton: a tMenuButton

-> Maybe b

menu: a tMenu, or Nothing to unset and disable the button

-> m () 

Sets the tMenu that will be popped up when the menuButton is clicked, or Nothing to dissociate any existing menu and disable the button.

If tMenuButton:menu-model or tMenuButton:popover are set, those objects are dissociated from the menuButton, and those properties are set to Nothing.

Since: 3.6

setUsePopover

menuButtonSetUsePopover Source #

Arguments

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

menuButton: a tMenuButton

-> Bool

usePopover: True to construct a popover from the menu model

-> m () 

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

Since: 3.12

Properties

alignWidget

The tWidget to use to align the menu with.

Since: 3.6

clearMenuButtonAlignWidget :: (MonadIO m, IsMenuButton o) => o -> m () Source #

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

clear #alignWidget

constructMenuButtonAlignWidget :: (IsMenuButton o, IsContainer a) => a -> IO (GValueConstruct o) Source #

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

getMenuButtonAlignWidget :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Container) Source #

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

get menuButton #alignWidget

setMenuButtonAlignWidget :: (MonadIO m, IsMenuButton o, IsContainer a) => o -> a -> m () Source #

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

set menuButton [ #alignWidget := value ]

direction

The tArrowType representing the direction in which the menu or popover will be popped out.

Since: 3.6

constructMenuButtonDirection :: IsMenuButton o => ArrowType -> IO (GValueConstruct o) Source #

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

getMenuButtonDirection :: (MonadIO m, IsMenuButton o) => o -> m ArrowType Source #

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

get menuButton #direction

setMenuButtonDirection :: (MonadIO m, IsMenuButton o) => o -> ArrowType -> m () Source #

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

set menuButton [ #direction := value ]

menuModel

The tMenuModel from which the popup will be created. Depending on the tMenuButton:use-popover property, that may be a menu or a popover.

See menuButtonSetMenuModel for the interaction with the tMenuButton:popup property.

Since: 3.6

clearMenuButtonMenuModel :: (MonadIO m, IsMenuButton o) => o -> m () Source #

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

clear #menuModel

constructMenuButtonMenuModel :: (IsMenuButton o, IsMenuModel a) => a -> IO (GValueConstruct o) Source #

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

getMenuButtonMenuModel :: (MonadIO m, IsMenuButton o) => o -> m (Maybe MenuModel) Source #

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

get menuButton #menuModel

setMenuButtonMenuModel :: (MonadIO m, IsMenuButton o, IsMenuModel a) => o -> a -> m () Source #

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

set menuButton [ #menuModel := value ]

popover

The tPopover that will be popped up when the button is clicked.

Since: 3.12

clearMenuButtonPopover :: (MonadIO m, IsMenuButton o) => o -> m () Source #

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

clear #popover

constructMenuButtonPopover :: (IsMenuButton o, IsPopover a) => a -> IO (GValueConstruct o) Source #

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

getMenuButtonPopover :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Popover) Source #

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

get menuButton #popover

setMenuButtonPopover :: (MonadIO m, IsMenuButton o, IsPopover a) => o -> a -> m () Source #

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

set menuButton [ #popover := value ]

popup

The tMenu that will be popped up when the button is clicked.

Since: 3.6

clearMenuButtonPopup :: (MonadIO m, IsMenuButton o) => o -> m () Source #

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

clear #popup

constructMenuButtonPopup :: (IsMenuButton o, IsMenu a) => a -> IO (GValueConstruct o) Source #

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

getMenuButtonPopup :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Menu) Source #

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

get menuButton #popup

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

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

set menuButton [ #popup := value ]

usePopover

Whether to construct a tPopover from the menu model, or a tMenu.

Since: 3.12

constructMenuButtonUsePopover :: IsMenuButton o => Bool -> IO (GValueConstruct o) Source #

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

getMenuButtonUsePopover :: (MonadIO m, IsMenuButton o) => o -> m Bool Source #

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

get menuButton #usePopover

setMenuButtonUsePopover :: (MonadIO m, IsMenuButton o) => o -> Bool -> m () Source #

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

set menuButton [ #usePopover := value ]