Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
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.
- newtype MenuButton = MenuButton (ManagedPtr MenuButton)
- class GObject o => IsMenuButton o
- toMenuButton :: IsMenuButton o => o -> IO MenuButton
- noMenuButton :: Maybe MenuButton
- data MenuButtonGetAlignWidgetMethodInfo
- menuButtonGetAlignWidget :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m (Maybe Widget)
- data MenuButtonGetDirectionMethodInfo
- menuButtonGetDirection :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m ArrowType
- data MenuButtonGetMenuModelMethodInfo
- menuButtonGetMenuModel :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m (Maybe MenuModel)
- data MenuButtonGetPopoverMethodInfo
- menuButtonGetPopover :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m (Maybe Popover)
- data MenuButtonGetPopupMethodInfo
- menuButtonGetPopup :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m (Maybe Menu)
- data MenuButtonGetUsePopoverMethodInfo
- menuButtonGetUsePopover :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m Bool
- menuButtonNew :: (HasCallStack, MonadIO m) => m MenuButton
- data MenuButtonSetAlignWidgetMethodInfo
- menuButtonSetAlignWidget :: (HasCallStack, MonadIO m, IsMenuButton a, IsWidget b) => a -> Maybe b -> m ()
- data MenuButtonSetDirectionMethodInfo
- menuButtonSetDirection :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> ArrowType -> m ()
- data MenuButtonSetMenuModelMethodInfo
- menuButtonSetMenuModel :: (HasCallStack, MonadIO m, IsMenuButton a, IsMenuModel b) => a -> Maybe b -> m ()
- data MenuButtonSetPopoverMethodInfo
- menuButtonSetPopover :: (HasCallStack, MonadIO m, IsMenuButton a, IsWidget b) => a -> Maybe b -> m ()
- data MenuButtonSetPopupMethodInfo
- menuButtonSetPopup :: (HasCallStack, MonadIO m, IsMenuButton a, IsWidget b) => a -> Maybe b -> m ()
- data MenuButtonSetUsePopoverMethodInfo
- menuButtonSetUsePopover :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> Bool -> m ()
- data MenuButtonAlignWidgetPropertyInfo
- clearMenuButtonAlignWidget :: (MonadIO m, IsMenuButton o) => o -> m ()
- constructMenuButtonAlignWidget :: (IsMenuButton o, IsContainer a) => a -> IO (GValueConstruct o)
- getMenuButtonAlignWidget :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Container)
- menuButtonAlignWidget :: AttrLabelProxy "alignWidget"
- setMenuButtonAlignWidget :: (MonadIO m, IsMenuButton o, IsContainer a) => o -> a -> m ()
- data MenuButtonDirectionPropertyInfo
- constructMenuButtonDirection :: IsMenuButton o => ArrowType -> IO (GValueConstruct o)
- getMenuButtonDirection :: (MonadIO m, IsMenuButton o) => o -> m ArrowType
- menuButtonDirection :: AttrLabelProxy "direction"
- setMenuButtonDirection :: (MonadIO m, IsMenuButton o) => o -> ArrowType -> m ()
- data MenuButtonMenuModelPropertyInfo
- clearMenuButtonMenuModel :: (MonadIO m, IsMenuButton o) => o -> m ()
- constructMenuButtonMenuModel :: (IsMenuButton o, IsMenuModel a) => a -> IO (GValueConstruct o)
- getMenuButtonMenuModel :: (MonadIO m, IsMenuButton o) => o -> m (Maybe MenuModel)
- menuButtonMenuModel :: AttrLabelProxy "menuModel"
- setMenuButtonMenuModel :: (MonadIO m, IsMenuButton o, IsMenuModel a) => o -> a -> m ()
- data MenuButtonPopoverPropertyInfo
- clearMenuButtonPopover :: (MonadIO m, IsMenuButton o) => o -> m ()
- constructMenuButtonPopover :: (IsMenuButton o, IsPopover a) => a -> IO (GValueConstruct o)
- getMenuButtonPopover :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Popover)
- menuButtonPopover :: AttrLabelProxy "popover"
- setMenuButtonPopover :: (MonadIO m, IsMenuButton o, IsPopover a) => o -> a -> m ()
- data MenuButtonPopupPropertyInfo
- clearMenuButtonPopup :: (MonadIO m, IsMenuButton o) => o -> m ()
- constructMenuButtonPopup :: (IsMenuButton o, IsMenu a) => a -> IO (GValueConstruct o)
- getMenuButtonPopup :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Menu)
- menuButtonPopup :: AttrLabelProxy "popup"
- setMenuButtonPopup :: (MonadIO m, IsMenuButton o, IsMenu a) => o -> a -> m ()
- data MenuButtonUsePopoverPropertyInfo
- constructMenuButtonUsePopover :: IsMenuButton o => Bool -> IO (GValueConstruct o)
- getMenuButtonUsePopover :: (MonadIO m, IsMenuButton o) => o -> m Bool
- menuButtonUsePopover :: AttrLabelProxy "usePopover"
- setMenuButtonUsePopover :: (MonadIO m, IsMenuButton o) => o -> Bool -> m ()
Exported types
newtype MenuButton Source #
GObject MenuButton Source # | |
IsImplementorIface MenuButton Source # | |
IsObject MenuButton Source # | |
IsWidget MenuButton Source # | |
IsToggleButton MenuButton Source # | |
IsContainer MenuButton Source # | |
IsButton MenuButton Source # | |
IsBin MenuButton Source # | |
IsBuildable MenuButton Source # | |
IsActivatable MenuButton Source # | |
IsActionable MenuButton Source # | |
IsMenuButton MenuButton Source # | |
((~) * info (ResolveMenuButtonMethod t MenuButton), MethodInfo * info MenuButton p) => IsLabel t (MenuButton -> p) Source # | |
((~) * info (ResolveMenuButtonMethod t MenuButton), MethodInfo * info MenuButton p) => IsLabelProxy t (MenuButton -> p) Source # | |
HasAttributeList * MenuButton Source # | |
type AttributeList MenuButton Source # | |
type SignalList MenuButton Source # | |
class GObject o => IsMenuButton o Source #
toMenuButton :: IsMenuButton o => o -> IO MenuButton Source #
Methods
getAlignWidget
data MenuButtonGetAlignWidgetMethodInfo Source #
((~) * signature (m (Maybe Widget)), MonadIO m, IsMenuButton a) => MethodInfo * MenuButtonGetAlignWidgetMethodInfo a signature Source # | |
menuButtonGetAlignWidget Source #
:: (HasCallStack, MonadIO m, IsMenuButton a) | |
=> a |
|
-> m (Maybe Widget) |
Returns the parent Widget
to use to line up with menu.
Since: 3.6
getDirection
data MenuButtonGetDirectionMethodInfo Source #
((~) * signature (m ArrowType), MonadIO m, IsMenuButton a) => MethodInfo * MenuButtonGetDirectionMethodInfo a signature Source # | |
menuButtonGetDirection Source #
:: (HasCallStack, MonadIO m, IsMenuButton a) | |
=> a |
|
-> m ArrowType | Returns: a |
Returns the direction the popup will be pointing at when popped up.
Since: 3.6
getMenuModel
data MenuButtonGetMenuModelMethodInfo Source #
((~) * signature (m (Maybe MenuModel)), MonadIO m, IsMenuButton a) => MethodInfo * MenuButtonGetMenuModelMethodInfo a signature Source # | |
menuButtonGetMenuModel Source #
:: (HasCallStack, MonadIO m, IsMenuButton a) | |
=> a |
|
-> m (Maybe MenuModel) |
Returns the MenuModel
used to generate the popup.
Since: 3.6
getPopover
data MenuButtonGetPopoverMethodInfo Source #
((~) * signature (m (Maybe Popover)), MonadIO m, IsMenuButton a) => MethodInfo * MenuButtonGetPopoverMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsMenuButton a) | |
=> a |
|
-> m (Maybe Popover) |
getPopup
data MenuButtonGetPopupMethodInfo Source #
((~) * signature (m (Maybe Menu)), MonadIO m, IsMenuButton a) => MethodInfo * MenuButtonGetPopupMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsMenuButton a) | |
=> a |
|
-> m (Maybe Menu) |
getUsePopover
data MenuButtonGetUsePopoverMethodInfo Source #
((~) * signature (m Bool), MonadIO m, IsMenuButton a) => MethodInfo * MenuButtonGetUsePopoverMethodInfo a signature Source # | |
menuButtonGetUsePopover Source #
:: (HasCallStack, MonadIO m, IsMenuButton a) | |
=> a |
|
-> m Bool |
new
:: (HasCallStack, MonadIO m) | |
=> m MenuButton | Returns: The newly created |
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
data MenuButtonSetAlignWidgetMethodInfo Source #
((~) * signature (Maybe b -> m ()), MonadIO m, IsMenuButton a, IsWidget b) => MethodInfo * MenuButtonSetAlignWidgetMethodInfo a signature Source # | |
menuButtonSetAlignWidget Source #
:: (HasCallStack, MonadIO m, IsMenuButton a, IsWidget b) | |
=> a |
|
-> Maybe b |
|
-> 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
data MenuButtonSetDirectionMethodInfo Source #
((~) * signature (ArrowType -> m ()), MonadIO m, IsMenuButton a) => MethodInfo * MenuButtonSetDirectionMethodInfo a signature Source # | |
menuButtonSetDirection Source #
:: (HasCallStack, MonadIO m, IsMenuButton a) | |
=> 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
data MenuButtonSetMenuModelMethodInfo Source #
((~) * signature (Maybe b -> m ()), MonadIO m, IsMenuButton a, IsMenuModel b) => MethodInfo * MenuButtonSetMenuModelMethodInfo a signature Source # | |
menuButtonSetMenuModel Source #
:: (HasCallStack, MonadIO m, IsMenuButton a, IsMenuModel b) | |
=> a |
|
-> Maybe b |
|
-> 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
data MenuButtonSetPopoverMethodInfo Source #
((~) * signature (Maybe b -> m ()), MonadIO m, IsMenuButton a, IsWidget b) => MethodInfo * MenuButtonSetPopoverMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsMenuButton a, IsWidget b) | |
=> a |
|
-> Maybe b |
|
-> 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
data MenuButtonSetPopupMethodInfo Source #
((~) * signature (Maybe b -> m ()), MonadIO m, IsMenuButton a, IsWidget b) => MethodInfo * MenuButtonSetPopupMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsMenuButton a, IsWidget b) | |
=> a |
|
-> Maybe b |
|
-> 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
data MenuButtonSetUsePopoverMethodInfo Source #
((~) * signature (Bool -> m ()), MonadIO m, IsMenuButton a) => MethodInfo * MenuButtonSetUsePopoverMethodInfo a signature Source # | |
menuButtonSetUsePopover Source #
:: (HasCallStack, MonadIO m, IsMenuButton a) | |
=> a |
|
-> Bool |
|
-> 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 #
clearMenuButtonAlignWidget :: (MonadIO m, IsMenuButton o) => o -> m () Source #
constructMenuButtonAlignWidget :: (IsMenuButton o, IsContainer a) => a -> IO (GValueConstruct o) Source #
getMenuButtonAlignWidget :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Container) Source #
menuButtonAlignWidget :: AttrLabelProxy "alignWidget" Source #
setMenuButtonAlignWidget :: (MonadIO m, IsMenuButton o, IsContainer a) => o -> a -> m () Source #
direction
data MenuButtonDirectionPropertyInfo Source #
constructMenuButtonDirection :: IsMenuButton o => ArrowType -> IO (GValueConstruct o) Source #
getMenuButtonDirection :: (MonadIO m, IsMenuButton o) => o -> m ArrowType Source #
menuButtonDirection :: AttrLabelProxy "direction" Source #
setMenuButtonDirection :: (MonadIO m, IsMenuButton o) => o -> ArrowType -> m () Source #
menuModel
data MenuButtonMenuModelPropertyInfo Source #
clearMenuButtonMenuModel :: (MonadIO m, IsMenuButton o) => o -> m () Source #
constructMenuButtonMenuModel :: (IsMenuButton o, IsMenuModel a) => a -> IO (GValueConstruct o) Source #
getMenuButtonMenuModel :: (MonadIO m, IsMenuButton o) => o -> m (Maybe MenuModel) Source #
menuButtonMenuModel :: AttrLabelProxy "menuModel" Source #
setMenuButtonMenuModel :: (MonadIO m, IsMenuButton o, IsMenuModel a) => o -> a -> m () Source #
popover
data MenuButtonPopoverPropertyInfo Source #
clearMenuButtonPopover :: (MonadIO m, IsMenuButton o) => o -> m () Source #
constructMenuButtonPopover :: (IsMenuButton o, IsPopover a) => a -> IO (GValueConstruct o) Source #
getMenuButtonPopover :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Popover) Source #
menuButtonPopover :: AttrLabelProxy "popover" Source #
setMenuButtonPopover :: (MonadIO m, IsMenuButton o, IsPopover a) => o -> a -> m () Source #
popup
data MenuButtonPopupPropertyInfo Source #
clearMenuButtonPopup :: (MonadIO m, IsMenuButton o) => o -> m () Source #
constructMenuButtonPopup :: (IsMenuButton o, IsMenu a) => a -> IO (GValueConstruct o) Source #
getMenuButtonPopup :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Menu) Source #
menuButtonPopup :: AttrLabelProxy "popup" Source #
setMenuButtonPopup :: (MonadIO m, IsMenuButton o, IsMenu a) => o -> a -> m () Source #
usePopover
data MenuButtonUsePopoverPropertyInfo Source #
constructMenuButtonUsePopover :: IsMenuButton o => Bool -> IO (GValueConstruct o) Source #
getMenuButtonUsePopover :: (MonadIO m, IsMenuButton o) => o -> m Bool Source #
menuButtonUsePopover :: AttrLabelProxy "usePopover" Source #
setMenuButtonUsePopover :: (MonadIO m, IsMenuButton o) => o -> Bool -> m () Source #