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 |
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.
- newtype PopoverMenu = PopoverMenu (ManagedPtr PopoverMenu)
- class GObject o => IsPopoverMenu o
- toPopoverMenu :: IsPopoverMenu o => o -> IO PopoverMenu
- noPopoverMenu :: Maybe PopoverMenu
- popoverMenuNew :: (HasCallStack, MonadIO m) => m PopoverMenu
- data PopoverMenuOpenSubmenuMethodInfo
- popoverMenuOpenSubmenu :: (HasCallStack, MonadIO m, IsPopoverMenu a) => a -> Text -> m ()
- data PopoverMenuVisibleSubmenuPropertyInfo
- clearPopoverMenuVisibleSubmenu :: (MonadIO m, IsPopoverMenu o) => o -> m ()
- constructPopoverMenuVisibleSubmenu :: IsPopoverMenu o => Text -> IO (GValueConstruct o)
- getPopoverMenuVisibleSubmenu :: (MonadIO m, IsPopoverMenu o) => o -> m (Maybe Text)
- popoverMenuVisibleSubmenu :: AttrLabelProxy "visibleSubmenu"
- setPopoverMenuVisibleSubmenu :: (MonadIO m, IsPopoverMenu o) => o -> Text -> m ()
Exported types
newtype PopoverMenu Source #
GObject PopoverMenu Source # | |
IsImplementorIface PopoverMenu Source # | |
IsObject PopoverMenu Source # | |
IsWidget PopoverMenu Source # | |
IsPopover PopoverMenu Source # | |
IsContainer PopoverMenu Source # | |
IsBin PopoverMenu Source # | |
IsBuildable PopoverMenu Source # | |
IsPopoverMenu PopoverMenu Source # | |
((~) * info (ResolvePopoverMenuMethod t PopoverMenu), MethodInfo * info PopoverMenu p) => IsLabel t (PopoverMenu -> p) Source # | |
((~) * info (ResolvePopoverMenuMethod t PopoverMenu), MethodInfo * info PopoverMenu p) => IsLabelProxy t (PopoverMenu -> p) Source # | |
HasAttributeList * PopoverMenu Source # | |
type AttributeList PopoverMenu Source # | |
type SignalList PopoverMenu Source # | |
class GObject o => IsPopoverMenu o Source #
toPopoverMenu :: IsPopoverMenu o => o -> IO PopoverMenu Source #
Methods
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
clearPopoverMenuVisibleSubmenu :: (MonadIO m, IsPopoverMenu o) => o -> m () Source #
constructPopoverMenuVisibleSubmenu :: IsPopoverMenu o => Text -> IO (GValueConstruct o) Source #
getPopoverMenuVisibleSubmenu :: (MonadIO m, IsPopoverMenu o) => o -> m (Maybe Text) Source #
popoverMenuVisibleSubmenu :: AttrLabelProxy "visibleSubmenu" Source #
setPopoverMenuVisibleSubmenu :: (MonadIO m, IsPopoverMenu o) => o -> Text -> m () Source #