Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: PopoverClosedCallback

[643:7] extends: object

Generated low-level callback wrapper for GIR callback closed.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • PopoverClosedCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.

class: PopoverActivatedefaultCallback

[573:7] extends: object

Generated low-level callback wrapper for GIR callback activate-default.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • PopoverActivatedefaultCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.

class: PopoverMeta

[713:14] static extends: object

Generated metadata helpers for Popover class surfaces.

Methods

  • properties ()

    Returns property metadata for Popover.

    • @r A list.
  • signals ()

    Returns signal metadata for Popover.

    • @r A list.

class: Popover

[65:7] extends: object

Presents a bubble-like popup. An example GtkPopover 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 [class@Gtk.MenuButton] and [class@Gtk.PopoverMenuBar] do. If you want to make a custom widget that has an attached popover, you need to call [method@Gtk.Popover.present] in your [vfunc@Gtk.Widget.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 [method@Gtk.Popover.set_position]. By default, it points to the whole widget area, but it can be made to point to a specific area using [method@Gtk.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, [method@Gtk.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 way to do this is to use the [class@Gtk.PopoverMenu] subclass which supports being populated from a GMenuModel with [ctor@Gtk.PopoverMenu.new_from_model]. xml <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> # Shortcuts and Gestures GtkPopover supports the following keyboard shortcuts: - Escape closes the popover. - Alt makes the mnemonics visible. The following signals have default keybindings: - [signal@Gtk.Popover::activate-default] # CSS nodes 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 [class@Gtk.PopoverMenu]. 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.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • Popover ()

    Creates a new GtkPopover.

  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asWidget ()

    Wraps this handle as Widget.

    • @r A Widget object.
  • asAccessible ()

    Wraps this handle as Accessible.

    • @r A Accessible object.
  • asBuildable ()

    Wraps this handle as Buildable.

    • @r A Buildable object.
  • asConstraintTarget ()

    Wraps this handle as ConstraintTarget.

    • @r A ConstraintTarget object.
  • asNative ()

    Wraps this handle as Native.

    • @r A Native object.
  • asShortcutManager ()

    Wraps this handle as ShortcutManager.

    • @r A ShortcutManager object.
  • connectSignal (string Name, CallbackObj)

    Connects one generated callback wrapper to a named signal.

    • @p Name is the signal name.
    • @p CallbackObj is the generated callback wrapper to connect.
    • @r The connected handler id.
  • disconnectSignalHandler (int HandlerId)

    Disconnects one retained signal handler id.

    • @p HandlerId is the signal handler id to disconnect.
    • @r None.
  • setOnActivatedefault (callback Fn, UserData = null)

    Emitted whend the user activates the default widget. This is a keybinding signal. The default binding for this signal is Enter.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (Popover Self).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • setOnClosed (callback Fn, UserData = null)

    Emitted when the popover is closed.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (Popover Self).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • getProperty (string Name)

    Reads one generated property by name.

  • setProperty (string Name, Value)

    Writes one generated property by name.

  • setAutohide (bool Value)

    Whether to dismiss the popover on outside clicks.

    • @p Value is the new property value.
    • @r None.
  • setCascadepopdown (bool Value)

    Whether the popover pops down after a child popover. This is used to implement the expected behavior of submenus.

    • @p Value is the new property value.
    • @r None.
  • setChild (object Value)

    The child widget.

    • @p Value is the new property value.
    • @r None.
  • setDefaultwidget (object Value)

    The default widget inside the popover.

    • @p Value is the new property value.
    • @r None.
  • setHasarrow (bool Value)

    Whether to draw an arrow.

    • @p Value is the new property value.
    • @r None.
  • setMnemonicsvisible (bool Value)

    Whether mnemonics are currently visible in this popover.

    • @p Value is the new property value.
    • @r None.
  • setPosition (string Value)

    How to place the popover, relative to its parent.

    • @p Value is the new property value.
    • @r None.
  • get_autohide ()

    Returns whether the popover is modal. See [method@Gtk.Popover.set_autohide] for the implications of this.

  • get_cascade_popdown ()

    Returns whether the popover will close after a modal child is closed.

  • get_child ()

    Gets the child widget of @popover.

  • get_has_arrow ()

    Gets whether this popover is showing an arrow pointing at the widget that it is relative to.

  • get_mnemonics_visible ()

    Gets whether mnemonics are visible.

  • get_position ()

    Returns the preferred position of @popover.

  • popdown ()

    Pops @popover down. This may have the side-effect of closing a parent popover as well. See [property@Gtk.Popover:cascade-popdown].

    • @r None.
  • popup ()

    Pops @popover up.

    • @r None.
  • present ()

    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 [method@Gtk.Popover.popup].

    • @r None.
  • set_autohide (bool autohide)

    Sets whether @popover 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.

    • @p autohide is %TRUE to dismiss the popover on outside clicks.
    • @r None.
  • set_cascade_popdown (bool cascade_popdown)

    If @cascade_popdown is %TRUE, the popover will be closed when a child modal popover is closed. If %FALSE, @popover will stay visible.

    • @p cascade_popdown is %TRUE if the popover should follow a child closing.
    • @r None.
  • set_child (object child)

    Sets the child widget of @popover.

    • @p child is the child widget.
    • @r None.
  • set_default_widget (object 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.

    • @p widget is a child widget of @popover to set as the default, or %NULL to unset the default widget for the popover.
    • @r None.
  • set_has_arrow (bool has_arrow)

    Sets whether this popover should draw an arrow pointing at the widget it is relative to.

    • @p has_arrow is %TRUE to draw an arrow.
    • @r None.
  • set_mnemonics_visible (bool mnemonics_visible)

    Sets whether mnemonics should be visible.

    • @p mnemonics_visible is the new value.
    • @r None.
  • set_offset (int x_offset, int y_offset)

    Sets the offset to use when calculating the position of the popover. These values are used when preparing the [struct@Gdk.PopupLayout] for positioning the popover.

    • @p x_offset is the x offset to adjust the position by.
    • @p y_offset is the y offset to adjust the position by.
    • @r None.
  • set_pointing_to (rect)

    Sets the rectangle that @popover points to. This is in the coordinate space of the @popover parent.

    • @p rect is rectangle to point to.
    • @r None.
  • set_position (string position)

    Sets the preferred position for @popover to appear. If the @popover 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.

    • @p position is preferred popover position.
    • @r None.