Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GtkPopoverMenu is a subclass of Popover
that treats its
children like menus and allows switching between them. It is
meant to be used primarily together with ModelButton
, but
any widget can be used, such as SpinButton
or Scale
.
In this respect, GtkPopoverMenu is more flexible than popovers
that are created from a MenuModel
with popoverNewFromModel
.
To add a child as a submenu, set the PopoverMenu
:submenu
child property to the name of the submenu. To let the user open
this submenu, add a ModelButton
whose ModelButton
:menu-name
property is set to the name you've given to the submenu.
By convention, the first child of a submenu should be a ModelButton
to switch back to the parent menu. Such a button should use the
ModelButton
:inverted
and ModelButton
:centered
properties
to achieve a title-like appearance and place the submenu indicator
at the opposite side. To switch back to the main menu, use "main"
as the menu name.
Example
<object class="GtkPopoverMenu"> <child> <object class="GtkBox"> <property name="visible">True</property> <property name="margin">10</property> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="action-name">win.frob</property> <property name="text" translatable="yes">Frob</property> </object> </child> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="menu-name">more</property> <property name="text" translatable="yes">More</property> </object> </child> </object> </child> <child> <object class="GtkBox"> <property name="visible">True</property> <property name="margin">10</property> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="action-name">win.foo</property> <property name="text" translatable="yes">Foo</property> </object> </child> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="action-name">win.bar</property> <property name="text" translatable="yes">Bar</property> </object> </child> </object> <packing> <property name="submenu">more</property> </packing> </child> </object>
Just like normal popovers created using gtk_popover_new_from_model,
PopoverMenu
instances have a single css node called "popover"
and get the .menu style class.
Synopsis
- newtype PopoverMenu = PopoverMenu (ManagedPtr PopoverMenu)
- class (GObject o, IsDescendantOf PopoverMenu o) => IsPopoverMenu o
- toPopoverMenu :: (MonadIO m, IsPopoverMenu o) => o -> m PopoverMenu
- popoverMenuNew :: (HasCallStack, MonadIO m) => m PopoverMenu
- popoverMenuOpenSubmenu :: (HasCallStack, MonadIO m, IsPopoverMenu a) => a -> Text -> m ()
- clearPopoverMenuVisibleSubmenu :: (MonadIO m, IsPopoverMenu o) => o -> m ()
- constructPopoverMenuVisibleSubmenu :: (IsPopoverMenu o, MonadIO m) => Text -> m (GValueConstruct o)
- getPopoverMenuVisibleSubmenu :: (MonadIO m, IsPopoverMenu o) => o -> m (Maybe Text)
- setPopoverMenuVisibleSubmenu :: (MonadIO m, IsPopoverMenu o) => o -> Text -> m ()
Exported types
newtype PopoverMenu Source #
Memory-managed wrapper type.
PopoverMenu (ManagedPtr PopoverMenu) |
Instances
Eq PopoverMenu Source # | |
Defined in GI.Gtk.Objects.PopoverMenu (==) :: PopoverMenu -> PopoverMenu -> Bool # (/=) :: PopoverMenu -> PopoverMenu -> Bool # | |
GObject PopoverMenu Source # | |
Defined in GI.Gtk.Objects.PopoverMenu | |
ManagedPtrNewtype PopoverMenu Source # | |
Defined in GI.Gtk.Objects.PopoverMenu toManagedPtr :: PopoverMenu -> ManagedPtr PopoverMenu | |
TypedObject PopoverMenu Source # | |
Defined in GI.Gtk.Objects.PopoverMenu | |
HasParentTypes PopoverMenu Source # | |
Defined in GI.Gtk.Objects.PopoverMenu | |
IsGValue (Maybe PopoverMenu) Source # | Convert |
Defined in GI.Gtk.Objects.PopoverMenu gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe PopoverMenu -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe PopoverMenu) | |
type ParentTypes PopoverMenu Source # | |
Defined in GI.Gtk.Objects.PopoverMenu |
class (GObject o, IsDescendantOf PopoverMenu o) => IsPopoverMenu o Source #
Type class for types which can be safely cast to PopoverMenu
, for instance with toPopoverMenu
.
Instances
(GObject o, IsDescendantOf PopoverMenu o) => IsPopoverMenu o Source # | |
Defined in GI.Gtk.Objects.PopoverMenu |
toPopoverMenu :: (MonadIO m, IsPopoverMenu o) => o -> m PopoverMenu Source #
Cast to PopoverMenu
, 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
Methods
activate, add, addAccelerator, addChild, addDeviceEvents, addEvents, addMnemonicLabel, addTickCallback, bindModel, bindProperty, bindPropertyFull, canActivateAccel, checkResize, childFocus, childGetProperty, childNotify, childNotifyByPspec, childSetProperty, childType, classPath, computeExpand, constructChild, createPangoContext, createPangoLayout, customFinished, customTagEnd, customTagStart, 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, 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, openSubmenu, overrideBackgroundColor, overrideColor, overrideCursor, overrideFont, overrideSymbolicColor, parserFinished, path, popdown, popup, propagateDraw, queueAllocate, queueComputeExpand, queueDraw, queueDrawArea, queueDrawRegion, queueResize, queueResizeNoRedraw, realize, ref, refSink, regionIntersect, registerWindow, remove, removeAccelerator, removeMnemonicLabel, removeTickCallback, renderIcon, renderIconPixbuf, reparent, resetRcStyles, resetStyle, resizeChildren, runDispose, 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, getChild, getChildRequisition, getChildVisible, getChildren, getClip, getClipboard, getCompositeName, getConstrainTo, getData, getDefaultWidget, 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, getModal, getModifierMask, getModifierStyle, getName, getNoShowAll, getOpacity, getPangoContext, getParent, getParentWindow, getPath, getPathForChild, getPointer, getPointingTo, getPosition, getPreferredHeight, getPreferredHeightAndBaselineForWidth, getPreferredHeightForWidth, getPreferredSize, getPreferredWidth, getPreferredWidthForHeight, getProperty, getQdata, getRealized, getReceivesDefault, getRelativeTo, getRequestMode, getRequisition, getResizeMode, getRootWindow, getScaleFactor, getScreen, getSensitive, getSettings, getSizeRequest, getState, getStateFlags, getStyle, getStyleContext, getSupportMultidevice, getTemplateChild, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getTransitionsEnabled, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisible, getVisual, getWindow.
Setters
setAccelPath, setAllocation, setAppPaintable, setBorderWidth, setBuildableProperty, setCanDefault, setCanFocus, setChildVisible, setClip, setCompositeName, setConstrainTo, setData, setDataFull, setDefaultWidget, setDeviceEnabled, setDeviceEvents, setDirection, setDoubleBuffered, setEvents, setFocusChain, setFocusChild, setFocusHadjustment, setFocusOnClick, setFocusVadjustment, setFontMap, setFontOptions, setHalign, setHasTooltip, setHasWindow, setHexpand, setHexpandSet, setMapped, setMarginBottom, setMarginEnd, setMarginLeft, setMarginRight, setMarginStart, setMarginTop, setModal, setName, setNoShowAll, setOpacity, setParent, setParentWindow, setPointingTo, setPosition, setProperty, setRealized, setReallocateRedraws, setReceivesDefault, setRedrawOnAllocate, setRelativeTo, setResizeMode, setSensitive, setSizeRequest, setState, setStateFlags, setStyle, setSupportMultidevice, setTooltipMarkup, setTooltipText, setTooltipWindow, setTransitionsEnabled, setValign, setVexpand, setVexpandSet, setVisible, setVisual, setWindow.
new
:: (HasCallStack, MonadIO m) | |
=> m PopoverMenu | Returns: a new |
Creates a new popover menu.
Since: 3.16
openSubmenu
popoverMenuOpenSubmenu Source #
:: (HasCallStack, MonadIO m, IsPopoverMenu a) | |
=> a |
|
-> Text |
|
-> m () |
Opens a submenu of the popover
. The name
must be one of the names given to the submenus
of popover
with PopoverMenu
:submenu
, or
"main" to switch back to the main menu.
ModelButton
will open submenus automatically
when the ModelButton
:menu-name
property is set,
so this function is only needed when you are using
other kinds of widgets to initiate menu changes.
Since: 3.16
Properties
visibleSubmenu
No description available in the introspection data.
clearPopoverMenuVisibleSubmenu :: (MonadIO m, IsPopoverMenu o) => o -> m () Source #
Set the value of the “visible-submenu
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#visibleSubmenu
constructPopoverMenuVisibleSubmenu :: (IsPopoverMenu o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “visible-submenu
” property. This is rarely needed directly, but it is used by new
.
getPopoverMenuVisibleSubmenu :: (MonadIO m, IsPopoverMenu o) => o -> m (Maybe Text) Source #
Get the value of the “visible-submenu
” property.
When overloading is enabled, this is equivalent to
get
popoverMenu #visibleSubmenu
setPopoverMenuVisibleSubmenu :: (MonadIO m, IsPopoverMenu o) => o -> Text -> m () Source #
Set the value of the “visible-submenu
” property.
When overloading is enabled, this is equivalent to
set
popoverMenu [ #visibleSubmenu:=
value ]