Overlay

class Overlay(**properties: Any)

Superclasses: Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Buildable, ConstraintTarget

Constructors:

Overlay(**properties)
new() -> Gtk.Widget

Constructors

class Overlay
classmethod new() Widget

Creates a new GtkOverlay.

Methods

class Overlay
add_overlay(widget: Widget) None

Adds widget to overlay.

The widget will be stacked on top of the main widget added with set_child.

The position at which widget is placed is determined from its halign and valign properties.

Parameters:

widget – a GtkWidget to be added to the container

get_child() Widget | None

Gets the child widget of overlay.

get_clip_overlay(widget: Widget) bool

Gets whether widget should be clipped within the parent.

Parameters:

widget – an overlay child of GtkOverlay

get_measure_overlay(widget: Widget) bool

Gets whether widget’s size is included in the measurement of overlay.

Parameters:

widget – an overlay child of GtkOverlay

remove_overlay(widget: Widget) None

Removes an overlay that was added with add_overlay().

Parameters:

widget – a GtkWidget to be removed

set_child(child: Widget | None = None) None

Sets the child widget of overlay.

Parameters:

child – the child widget

set_clip_overlay(widget: Widget, clip_overlay: bool) None

Sets whether widget should be clipped within the parent.

Parameters:
  • widget – an overlay child of GtkOverlay

  • clip_overlay – whether the child should be clipped

set_measure_overlay(widget: Widget, measure: bool) None

Sets whether widget is included in the measured size of overlay.

The overlay will request the size of the largest child that has this property set to True. Children who are not included may be drawn outside of overlay’s allocation if they are too large.

Parameters:
  • widget – an overlay child of GtkOverlay

  • measure – whether the child should be measured

Properties

class Overlay
props.child: Widget

The main child widget.

Signals

class Overlay.signals
get_child_position(widget: Widget) tuple[bool, Rectangle]

Emitted to determine the position and size of any overlay child widgets.

A handler for this signal should fill allocation with the desired position and size for widget, relative to the ‘main’ child of overlay.

The default handler for this signal uses the widget’s halign and valign properties to determine the position and gives the widget its natural size (except that an alignment of FILL will cause the overlay to be full-width/height). If the main child is a GtkScrolledWindow, the overlays are placed relative to its contents.

Parameters:

widget – the child widget to position