Popover
open class Popover : Bin, PopoverProtocol
GtkPopover is a bubble-like context window, primarily meant to
provide context-dependent information or options. Popovers are
attached to a widget, passed at construction time on gtk_popover_new(),
or updated afterwards through gtk_popover_set_relative_to(), by
default they will point to the whole widget area, although this
behavior can be changed through gtk_popover_set_pointing_to().
The position of a popover relative to the widget it is attached to
can also be changed through gtk_popover_set_position().
By default, GtkPopover performs a GTK+ 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 Esc key being pressed). If no such modal behavior
is desired on a popover, gtk_popover_set_modal() may be called on it
to tweak its behavior.
GtkPopover as menu replacement
GtkPopover is often used to replace menus. To facilitate this, it
supports being populated from a GMenuModel, using
gtk_popover_new_from_model(). In addition to all the regular menu
model features, this function supports rendering sections in the
model in a more compact form, as a row of icon buttons instead of
menu items.
To use this rendering, set the ”display-hint” attribute of the section to ”horizontal-buttons” and set the icons of your items with the ”verb-icon” attribute.
<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
GtkPopover has a single css node called popover. It always gets the
.background style class and it gets the .menu style class if it is
menu-like (e.g. GtkPopoverMenu or created using gtk_popover_new_from_model().
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.
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
Popoverinstance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<GtkPopover>)Parameters
oppointer to the underlying object
-
Designated initialiser from a constant pointer to the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopoverinstance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<GtkPopover>)Parameters
oppointer to the underlying object
-
Optional initialiser from a non-mutating
gpointerto the underlyingCdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopoverinstance.Declaration
Swift
@inlinable override public init!(gpointer op: gpointer?)Parameters
opgpointer to the underlying object
-
Optional initialiser from a non-mutating
gconstpointerto the underlyingCdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopoverinstance.Declaration
Swift
@inlinable override public init!(gconstpointer op: gconstpointer?)Parameters
oppointer to the underlying object
-
Optional initialiser from a constant pointer to the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopoverinstance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<GtkPopover>?)Parameters
oppointer to the underlying object
-
Optional initialiser from the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopoverinstance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<GtkPopover>?)Parameters
oppointer to the underlying object
-
Designated initialiser from the underlying
Cdata type. Will retainGtkPopover. i.e., ownership is transferred to thePopoverinstance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<GtkPopover>)Parameters
oppointer to the underlying object
-
Reference intialiser for a related type that implements
PopoverProtocolWill retainGtkPopover.Declaration
Swift
@inlinable public init<T>(popover other: T) where T : PopoverProtocolParameters
otheran 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
cPointerpointer 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
cPointerpointer 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
praw 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
pmutable 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
rawmutable 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
popaque 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
popaque pointer to the underlying object
-
Creates a new popover to point to
relative_toDeclaration
Swift
@inlinable public init<WidgetT>(relativeTo: WidgetT?) where WidgetT : WidgetProtocol -
Creates a
GtkPopoverand populates it according tomodel. The popover is pointed to therelative_towidget.The created buttons are connected to actions found in the
GtkApplicationWindowto which the popover belongs - typically by means of being attached to a widget that is contained within theGtkApplicationWindowswidget hierarchy.Actions can also be added using
gtk_widget_insert_action_group()on the menus attach widget or on any of its parent widgets.Declaration
Swift
@inlinable public init<MenuModelT, WidgetT>(model relativeTo: WidgetT?, model: MenuModelT) where MenuModelT : MenuModelProtocol, WidgetT : WidgetProtocol -
Creates a
GtkPopoverand populates it according tomodel. The popover is pointed to therelative_towidget.The created buttons are connected to actions found in the
GtkApplicationWindowto which the popover belongs - typically by means of being attached to a widget that is contained within theGtkApplicationWindowswidget hierarchy.Actions can also be added using
gtk_widget_insert_action_group()on the menus attach widget or on any of its parent widgets.Declaration
Swift
@inlinable public static func newFrom<MenuModelT, WidgetT>(model relativeTo: WidgetT?, model: MenuModelT) -> Widget! where MenuModelT : MenuModelProtocol, WidgetT : WidgetProtocol
View on GitHub
Install in Dash
Popover Class Reference