Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: GdkPopupLayout

[33:7] extends: object

Contains information that is necessary position a [iface@Gdk.Popup] relative to its parent. The positioning requires a negotiation with the windowing system, since it depends on external constraints, such as the position of the parent surface, and the screen dimensions. The basic ingredients are a rectangle on the parent surface, and the anchor on both that rectangle and the popup. The anchors specify a side or corner to place next to each other. Popup anchors For cases where placing the anchors next to each other would make the popup extend offscreen, the layout includes some hints for how to resolve this problem. The hints may suggest to flip the anchor position to the other side, or to 'slide' the popup along a side, or to resize it. Flipping popups Sliding
popups These hints may be combined. Ultimatively, it is up to the windowing system to determine the position and size of the popup. You can learn about the result by calling [method@Gdk.Popup.get_position_x], [method@Gdk.Popup.get_position_y], [method@Gdk.Popup.get_rect_anchor] and [method@Gdk.Popup.get_surface_anchor] after the popup has been presented. This can be used to adjust the rendering. For example, GtkPopover changes its arrow position accordingly. But you have to be careful avoid changing the size of the popover, or it has to be presented again.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • GdkPopupLayout (anchor_rect = null, rect_anchor = null, surface_anchor = null)

    Create a popup layout description. Used together with [method@Gdk.Popup.present] to describe how a popup surface should be placed and behave on-screen. @anchor_rect is relative to the top-left corner of the surface's parent. @rect_anchor and @surface_anchor determine anchor points on @anchor_rect and surface to pin together. The position of @anchor_rect's anchor point can optionally be offset using [method@Gdk.PopupLayout.set_offset], which is equivalent to offsetting the position of surface.

    • @p anchor_rect is the anchor rectangle to align @surface with.
    • @p rect_anchor is the point on @anchor_rect to align with @surface's anchor point.
    • @p surface_anchor is the point on @surface to align with @rect's anchor point.
  • 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.
  • copy ()

    Makes a copy of @layout.

    • @r a copy of @layout..
  • equal (object other)

    Check whether @layout and @other has identical layout properties.

    • @p other is another popup layout.
    • @r true if @layout and @other have identical layout properties, otherwise false..
  • get_anchor_hints ()

    Get the anchor hints.

    • @r the anchor hints.
  • get_anchor_rect ()

    Get the anchor rectangle.

    • @r The anchor rectangle.
  • get_offset ()

    Retrieves the offset for the anchor rectangle.

    • @p dx is return location for the delta X coordinate.
    • @p dy is return location for the delta Y coordinate.
    • @r None.
  • get_rect_anchor ()

    Returns the anchor position on the anchor rectangle.

    • @r the anchor on the anchor rectangle..
  • get_shadow_width ()

    Obtains the shadow widths of this layout.

    • @p left is return location for the left shadow width.
    • @p right is return location for the right shadow width.
    • @p top is return location for the top shadow width.
    • @p bottom is return location for the bottom shadow width.
    • @r None.
  • get_surface_anchor ()

    Returns the anchor position on the popup surface.

    • @r the anchor on the popup surface..
  • ref ()

    Increases the reference count of @value.

    • @r the same @layout.
  • set_anchor_hints (string anchor_hints)

    Set new anchor hints. The set @anchor_hints determines how @surface will be moved if the anchor points cause it to move off-screen. For example, GDK_ANCHOR_FLIP_X will replace GDK_GRAVITY_NORTH_WEST with GDK_GRAVITY_NORTH_EAST and vice versa if @surface extends beyond the left or right edges of the monitor.

    • @p anchor_hints is the new anchor hints.
    • @r None.
  • set_anchor_rect (object anchor_rect)

    Set the anchor rectangle.

    • @p anchor_rect is the new anchor rectangle.
    • @r None.
  • set_offset (int dx, int dy)

    Offset the position of the anchor rectangle with the given delta.

    • @p dx is x delta to offset the anchor rectangle with.
    • @p dy is y delta to offset the anchor rectangle with.
    • @r None.
  • set_rect_anchor (string anchor)

    Set the anchor on the anchor rectangle.

    • @p anchor is the new rect anchor.
    • @r None.
  • set_shadow_width (int left, int right, int top, int bottom)

    Sets the shadow width of the popup. The shadow width corresponds to the part of the computed surface size that would consist of the shadow margin surrounding the window, would there be any.

    • @p left is width of the left part of the shadow.
    • @p right is width of the right part of the shadow.
    • @p top is height of the top part of the shadow.
    • @p bottom is height of the bottom part of the shadow.
    • @r None.
  • set_surface_anchor (string anchor)

    Set the anchor on the popup surface.

    • @p anchor is the new popup surface anchor.
    • @r None.
  • unref ()

    Decreases the reference count of @value.

    • @r None.