Popover

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> ]|

Constructors

this
this(GtkPopover* gtkPopover, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(Widget relativeTo)

Creates a new popover to point to @relative_to

this
this(Widget relativeTo, MenuModel model)

Creates a #GtkPopover and populates it according to @model. The popover is pointed to the @relative_to widget.

Members

Functions

addOnClosed
void addOnClosed(void delegate(Popover) dlg, ConnectFlags connectFlags)
Undocumented in source. Be warned that the author may not have intended to support it.
bindModel
void bindModel(MenuModel model, string actionNamespace)

Establishes a binding between a #GtkPopover and a #GMenuModel.

getDefaultWidget
Widget getDefaultWidget()

Gets the widget that should be set as the default while the popover is shown.

getModal
bool getModal()

Returns whether the popover is modal, see gtk_popover_set_modal to see the implications of this.

getPointingTo
bool getPointingTo(GdkRectangle rect)

If a rectangle to point to has been set, this function will return %TRUE and fill in @rect with such rectangle, otherwise it will return %FALSE and fill in @rect with the attached widget coordinates.

getPopoverStruct
GtkPopover* getPopoverStruct()

Get the main Gtk struct

getPosition
GtkPositionType getPosition()

Returns the preferred position of @popover.

getRelativeTo
Widget getRelativeTo()

Returns the widget @popover is currently attached to

getStruct
void* getStruct()

the main Gtk struct as a void*

getTransitionsEnabled
bool getTransitionsEnabled()

Returns whether show/hide transitions are enabled on this popover.

setDefaultWidget
void setDefaultWidget(Widget widget)

Sets the widget that should be set as default widget while the popover is shown (see gtk_window_set_default()). #GtkPopover remembers the previous default widget and reestablishes it when the popover is dismissed.

setModal
void setModal(bool modal)

Sets whether @popover is modal, a modal popover will grab all input within the toplevel and grab the keyboard focus on it when being displayed. Clicking outside the popover area or pressing Esc will dismiss the popover and ungrab input.

setPointingTo
void setPointingTo(GdkRectangle* rect)

Sets the rectangle that @popover will point to, in the coordinate space of the widget @popover is attached to, see gtk_popover_set_relative_to().

setPosition
void setPosition(GtkPositionType position)

Sets the preferred position for @popover to appear. If the @popover is currently visible, it will be immediately updated.

setRelativeTo
void setRelativeTo(Widget relativeTo)

Sets a new widget to be attached to @popover. If @popover is visible, the position will be updated.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
setTransitionsEnabled
void setTransitionsEnabled(bool transitionsEnabled)

Sets whether show/hide transitions are enabled on this popover

Static functions

callBackClosed
void callBackClosed(GtkPopover* popoverStruct, Popover _popover)
Undocumented in source. Be warned that the author may not have intended to support it.
getType
GType getType()

Variables

connectedSignals
int[string] connectedSignals;
Undocumented in source.
gtkPopover
GtkPopover* gtkPopover;

the main Gtk struct

onClosedListeners
void delegate(Popover)[] onClosedListeners;
Undocumented in source.

Inherited Members

From Bin

gtkBin
GtkBin* gtkBin;

the main Gtk struct

getBinStruct
GtkBin* getBinStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
getType
GType getType()
getChild
Widget getChild()

Gets the child of the #GtkBin, or %NULL if the bin contains no child widget. The returned widget does not have a reference added, so you do not need to unref it.

Meta