It derives from <GtkWidget>.
Presents a bubble-like popup.
It is primarily meant to provide context-dependent information or
options. Popovers are attached to a parent widget. The parent widget
must support popover children, as
<GtkMenuButton> and
<GtkPopoverMenuBar> do. If you want to
make a custom widget that has an attached popover, you need to call
popover:present in your widget:do-size-allocate vfunc, in order to update
the positioning of the popover.
The position of a popover relative to the widget it is attached to can
also be changed with popover:set-position. By default, it points to the
whole widget area, but it can be made to point to a specific area using
popover:set-pointing-to.
By default, <GtkPopover> performs a grab, in order
to ensure input events get redirected to it while it is shown, and also
so the popover is dismissed in the expected situations (clicks outside
the popover, or the Escape key being pressed). If no such modal
behavior is desired on a popover, popover:set-autohide may be called on it to tweak its
behavior.
<GtkPopover> is often used to replace menus. The
best way to do this is to use the
<GtkPopoverMenu> subclass which supports being
populated from a <GMenuModel> with
popover-menu:new-from-model.
<section>
<attribute name="display-hint">horizontal-buttons</attribute>
<item>
<attribute name="label">Cut</attribute>
<attribute name="action">app.cut</attribute>
<attribute name="verb-icon">edit-cut-symbolic</attribute>
</item>
<item>
<attribute name="label">Copy</attribute>
<attribute name="action">app.copy</attribute>
<attribute name="verb-icon">edit-copy-symbolic</attribute>
</item>
<item>
<attribute name="label">Paste</attribute>
<attribute name="action">app.paste</attribute>
<attribute name="verb-icon">edit-paste-symbolic</attribute>
</item>
</section>
<GtkPopover> supports the following keyboard
shortcuts:
The following signals have default keybindings:
popover.background[.menu]
├── arrow
╰── contents
╰── <child>
<GtkPopover> has a main node with name
popover, an arrow with name arrow, and another node for
the content named contents. The popover node always gets
the .background style class. It also gets the .menu style
class if the popover is menu-like, e.g. is a
<GtkPopoverMenu>.
Particular uses of <GtkPopover>, such as touch
selection popups or magnifiers in <GtkEntry> or
<GtkTextView> get style classes like
.touch-selection or .magnifier to differentiate from plain
popovers.
When styling a popover directly, the popover node should usually
not have any background. The visible part of the popover can have a
shadow. To specify it in CSS, set the box-shadow of the contents
node.
Note that, in order to accomplish appropriate arrow visuals,
<GtkPopover> uses custom drawing for the
arrow node. This makes it possible for the arrow to change its
shape dynamically, but it also limits the possibilities of styling it
using CSS. In particular, the arrow gets drawn over the
content node’s border and shadow, so they look like one shape,
which means that the border width of the content node and the
arrow node should be the same. The arrow also does not support
any border shape other than solid, no border-radius, only one border
width (border-bottom-width is used) and no box-shadow.
parentWhether to dismiss the popover on outside clicks.
Its value is a boolean.
Set it with (set! (popover:autohide self) value).
Whether the popover pops down after a child popover.
This is used to implement the expected behavior of submenus.
Its value is a boolean.
Set it with (set! (popover:cascade-popdown self) value).
The child widget.
Its value is a <GtkWidget>, or #f.
Set it with (set! (popover:child self) value).
The default widget inside the popover.
Its value is a <GtkWidget>, or #f.
Set it with (set! (popover:default-widget self) value).
Whether to draw an arrow.
Its value is a boolean.
Set it with (set! (popover:has-arrow self) value).
Whether mnemonics are currently visible in this popover.
Its value is a boolean.
Set it with (set! (popover:mnemonics-visible self) value).
Rectangle in the parent widget that the popover points to.
Its value is a <GdkRectangle>, or #f.
Set it with (set! (popover:pointing-to self) value).
How to place the popover, relative to its parent.
Its value is a <GtkPositionType> (or, to set
it, one of its symbols).
Set it with (set! (popover:position self) value).
Returns whether the popover is modal.
See popover:set-autohide for the
implications of this.
Passed: a <GtkPopover>.
Returned: a boolean.
#t if self is modal
Returns whether the popover will close after a modal child is closed.
Passed: a <GtkPopover>.
Returned: a boolean.
#t if self will close after a modal child.
Gets the child widget of self.
Passed: a <GtkPopover>.
Returned: a <GtkWidget>, or #f.
the child widget of self
Gets whether this popover is showing an arrow pointing at the widget that it is relative to.
Passed: a <GtkPopover>.
Returned: a boolean.
whether the popover has an arrow
Gets whether mnemonics are visible.
Passed: a <GtkPopover>.
Returned: a boolean.
#t if mnemonics are supposed to be visible in this popover
Gets the offset previous set with popover:set-offset.
Passed: a <GtkPopover>.
Returned: a 32-bit integer.
a location for the x_offset
Returned: a 32-bit integer.
a location for the y_offset
Gets the rectangle that the popover points to.
If a rectangle to point to has been set, this function will return
#t and fill in rect with such rectangle, otherwise it will
return #f and fill in rect with the parent widget
coordinates.
Passed: a <GtkPopover>.
Passed, filled in, and returned: a
<GdkRectangle>.
location to store the rectangle
Returned: a boolean.
#t if a rectangle to point to was set.
Returns the preferred position of self.
Passed: a <GtkPopover>.
Returned: a <GtkPositionType>.
The preferred position.
Creates a new <GtkPopover>.
Returned: a <GtkWidget>.
the new <GtkPopover>
Pops self down.
This may have the side-effect of closing a parent popover as well. See
popover:cascade-popdown.
Passed: a <GtkPopover>.
Pops self up.
Passed: a <GtkPopover>.
Allocate a size for the <GtkPopover>.
This function needs to be called in size-allocate by widgets who have a
<GtkPopover> as child. When using a layout
manager, this is happening automatically.
To make a popover appear on screen, use popover:popup.
Passed: a <GtkPopover>.
Sets whether self is modal.
A modal popover will grab the keyboard focus on it when being displayed. Focus will wrap around within the popover. Clicking outside the popover area or pressing Esc will dismiss the popover.
Called this function on an already showing popup with a new autohide value different from the current one, will cause the popup to be hidden.
Passed: a <GtkPopover>.
Passed: a boolean.
#t to dismiss the popover on outside clicks
If cascade-popdown is #t, the popover will be closed when a
child modal popover is closed.
If #f, self will stay visible.
Passed: a <GtkPopover>.
Passed: a boolean.
#t if the popover should follow a child closing
Sets the child widget of self.
Passed: a <GtkPopover>.
Passed, or left out: a <GtkWidget>, or #f.
the child widget
Sets the default widget of a <GtkPopover>.
The default widget is the widget that’s activated when the user presses
Enter in a dialog (for example). This function sets or unsets the
default widget for a <GtkPopover>.
Passed: a <GtkPopover>.
Passed, or left out: a <GtkWidget>, or #f.
a child widget of self to set as the default, or #f to
unset the default widget for the popover
Sets whether this popover should draw an arrow pointing at the widget it is relative to.
Passed: a <GtkPopover>.
Passed: a boolean.
#t to draw an arrow
Sets whether mnemonics should be visible.
Passed: a <GtkPopover>.
Passed: a boolean.
the new value
Sets the offset to use when calculating the position of the popover.
These values are used when preparing the
<GdkPopupLayout> for positioning the
popover.
Passed: a <GtkPopover>.
Passed: a 32-bit integer.
the x offset to adjust the position by
Passed: a 32-bit integer.
the y offset to adjust the position by
Sets the rectangle that self points to.
This is in the coordinate space of the self parent.
Passed: a <GtkPopover>.
Passed, or left out: a <GdkRectangle>, or
#f.
rectangle to point to
Sets the preferred position for self to appear.
If the self is currently visible, it will be immediately updated.
This preference will be respected where possible, although on lack of
space (eg. if close to the window edges), the
<GtkPopover> may choose to appear on the opposite
side.
Passed: a <GtkPopover>.
Passed: a <GtkPositionType>, or one of its
symbols.
preferred popover position
Connect a handler with (connect object popover:activate-default
handler). It is called as (handler self).
Emitted whend the user activates the default widget.
This is a keybinding signal.
The default binding for this signal is Enter.
Passed: a <GtkPopover>.
Connect a handler with (connect object popover:closed handler).
It is called as (handler self).
Emitted when the popover is closed.
Passed: a <GtkPopover>.
To override it in a new class, give register-type #:vfuncs
`((activate-default . ,procedure)). The procedure is called as
(procedure self).
Passed: the class whose implementation to call:
<GtkPopover>, or a class that derives from it, or
its GType number.
Passed: a <GtkPopover>.
To override it in a new class, give register-type #:vfuncs
`((closed . ,procedure)). The procedure is called as (procedure
self).
Passed: the class whose implementation to call:
<GtkPopover>, or a class that derives from it, or
its GType number.
Passed: a <GtkPopover>.