Popover
open class Popover : Widget, PopoverProtocol
GtkPopover
is a bubble-like context popup.
It is primarily meant to provide context-dependent information
or options. Popovers are attached to a parent widget. By default,
they point to the whole widget area, although this behavior can be
changed with [methodGtk.Popover.set_pointing_to
].
The position of a popover relative to the widget it is attached to
can also be changed with [methodGtk.Popover.set_position
]
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, [methodGtk.Popover.set_autohide
] may be called on it to
tweak its behavior.
GtkPopover as menu replacement
GtkPopover
is often used to replace menus. The best was to do this
is to use the [classGtk.PopoverMenu
] subclass which supports being
populated from a GMenuModel
with [ctorGtk.PopoverMenu.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>
CSS nodes
popover[.menu]
├── arrow
╰── contents.background
╰── <child>
The contents child node always gets the .background style class
and the popover itself gets the .menu style class if the popover
is menu-like (i.e. 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.
The Popover
type acts as a reference-counted owner of an underlying GtkPopover
instance.
It provides the methods that can operate on this data type through PopoverProtocol
conformance.
Use Popover
as a strong reference or owner of a GtkPopover
instance.
-
Designated initialiser from the underlying `C` data type.
This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the
Popover
instance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<GtkPopover>)
Parameters
op
pointer to the underlying object
-
Designated initialiser from a constant pointer to the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopover
instance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<GtkPopover>)
Parameters
op
pointer to the underlying object
-
Optional initialiser from a non-mutating
gpointer
to the underlyingC
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopover
instance.Declaration
Swift
@inlinable override public init!(gpointer op: gpointer?)
Parameters
op
gpointer to the underlying object
-
Optional initialiser from a non-mutating
gconstpointer
to the underlyingC
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopover
instance.Declaration
Swift
@inlinable override public init!(gconstpointer op: gconstpointer?)
Parameters
op
pointer to the underlying object
-
Optional initialiser from a constant pointer to the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopover
instance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<GtkPopover>?)
Parameters
op
pointer to the underlying object
-
Optional initialiser from the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopover
instance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<GtkPopover>?)
Parameters
op
pointer to the underlying object
-
Designated initialiser from the underlying
C
data type. Will retainGtkPopover
. i.e., ownership is transferred to thePopover
instance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<GtkPopover>)
Parameters
op
pointer to the underlying object
-
Reference intialiser for a related type that implements
PopoverProtocol
Will retainGtkPopover
.Declaration
Swift
@inlinable public init<T>(popover other: T) where T : PopoverProtocol
Parameters
other
an instance of a related type that implements
PopoverProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopoverProtocol
.Declaration
Swift
@inlinable override public init<T>(cPointer p: UnsafeMutablePointer<T>)
Parameters
cPointer
pointer to the underlying object
-
Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopoverProtocol
.Declaration
Swift
@inlinable override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)
Parameters
cPointer
pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopoverProtocol
.Declaration
Swift
@inlinable override public init(raw p: UnsafeRawPointer)
Parameters
p
raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopoverProtocol
.Declaration
Swift
@inlinable override public init(retainingRaw raw: UnsafeRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopoverProtocol
.Declaration
Swift
@inlinable public required init(raw p: UnsafeMutableRawPointer)
Parameters
p
mutable raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopoverProtocol
.Declaration
Swift
@inlinable required public init(retainingRaw raw: UnsafeMutableRawPointer)
Parameters
raw
mutable raw pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopoverProtocol
.Declaration
Swift
@inlinable override public init(opaquePointer p: OpaquePointer)
Parameters
p
opaque pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopoverProtocol
.Declaration
Swift
@inlinable override public init(retainingOpaquePointer p: OpaquePointer)
Parameters
p
opaque pointer to the underlying object
-
Creates a new
GtkPopover
.Declaration
Swift
@inlinable public init()