:right-sidebar: True PopupLayout =================================================================== .. currentmodule:: gi.repository.Gdk .. class:: PopupLayout(**kwargs) :no-contents-entry: :Constructors: :: new(anchor_rect:Gdk.Rectangle, rect_anchor:Gdk.Gravity, surface_anchor:Gdk.Gravity) -> Gdk.PopupLayout Constructors ------------ .. rst-class:: interim-class .. class:: PopupLayout :no-index: .. classmethod:: new(anchor_rect: ~gi.repository.Gdk.Rectangle, rect_anchor: ~gi.repository.Gdk.Gravity, surface_anchor: ~gi.repository.Gdk.Gravity) -> ~gi.repository.Gdk.PopupLayout Create a popup layout description. Used together with :obj:`~gi.repository.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 :obj:`~gi.repository.Gdk.PopupLayout.set_offset`, which is equivalent to offsetting the position of surface. :param anchor_rect: the anchor ``GdkRectangle`` to align ``surface`` with :param rect_anchor: the point on ``anchor_rect`` to align with ``surface``'s anchor point :param surface_anchor: the point on ``surface`` to align with ``rect``'s anchor point Methods ------- .. rst-class:: interim-class .. class:: PopupLayout :no-index: .. method:: equal(other: ~gi.repository.Gdk.PopupLayout) -> bool Check whether ``layout`` and ``other`` has identical layout properties. :param other: another ``GdkPopupLayout`` .. method:: get_anchor_hints() -> ~gi.repository.Gdk.AnchorHints Get the ``GdkAnchorHints``. .. method:: get_anchor_rect() -> ~gi.repository.Gdk.Rectangle Get the anchor rectangle. .. method:: get_offset() -> tuple[int, int] Retrieves the offset for the anchor rectangle. .. method:: get_rect_anchor() -> ~gi.repository.Gdk.Gravity Returns the anchor position on the anchor rectangle. .. method:: get_shadow_width() -> tuple[int, int, int, int] Obtains the shadow widths of this layout. .. versionadded:: 4.2 .. method:: get_surface_anchor() -> ~gi.repository.Gdk.Gravity Returns the anchor position on the popup surface. .. method:: set_anchor_hints(anchor_hints: ~gi.repository.Gdk.AnchorHints) -> None 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, :const:`~gi.repository.Gdk.AnchorHints.FLIP_X` will replace :const:`~gi.repository.Gdk.Gravity.NORTH_WEST` with :const:`~gi.repository.Gdk.Gravity.NORTH_EAST` and vice versa if ``surface`` extends beyond the left or right edges of the monitor. :param anchor_hints: the new ``GdkAnchorHints`` .. method:: set_anchor_rect(anchor_rect: ~gi.repository.Gdk.Rectangle) -> None Set the anchor rectangle. :param anchor_rect: the new anchor rectangle .. method:: set_offset(dx: int, dy: int) -> None Offset the position of the anchor rectangle with the given delta. :param dx: x delta to offset the anchor rectangle with :param dy: y delta to offset the anchor rectangle with .. method:: set_rect_anchor(anchor: ~gi.repository.Gdk.Gravity) -> None Set the anchor on the anchor rectangle. :param anchor: the new rect anchor .. method:: set_shadow_width(left: int, right: int, top: int, bottom: int) -> None 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. .. versionadded:: 4.2 :param left: width of the left part of the shadow :param right: width of the right part of the shadow :param top: height of the top part of the shadow :param bottom: height of the bottom part of the shadow .. method:: set_surface_anchor(anchor: ~gi.repository.Gdk.Gravity) -> None Set the anchor on the popup surface. :param anchor: the new popup surface anchor