Package: gtk

Class gtk:overlay

Superclasses

Documented Subclasses

None

Direct Slots

child
The child property of type gtk:widget (Read / Write)
The main child widget of the overlay.
Default value: nil

Details

The gtk:overlay widget contains a single main widget, on top of which it can place overlay widgets.

Figure: GtkOverlay

The position of each overlay widget is determined by its halign and valign properties. For example, an overlay widget with both alignments set to :start will be placed at the top left corner of the main widget, whereas an overlay widget with the halign property set to :center and the valign property set to :end will be placed a the bottom edge of the main widget, horizontally centered. The position can be adjusted by setting the margin properties of the overlay widget to non-zero values.

More complicated placement of overlay widgets is possible by connecting to the "get-child-position" signal.

The minimum and natural sizes of an overlay widget are those of its main child. The sizes of overlay children are not considered when measuring these preferred sizes.

GtkOverlay as GtkBuildable

The gtk:overlay implementation of the gtk:buildable interface supports placing a child widget as an overlay by specifying "overlay" as the "type" attribute of a <child> element.

CSS nodes

The gtk:overlay implementation has a single CSS node with the name overlay. Overlay children whose alignments cause them to be positioned at an edge get the .left, .right, .top, and/or .bottom style classes according to their position.

Signal Details

The "get-child-position" signal
lambda (overlay widget allocation)    :run-last      
overlay
The gtk:overlay widget which emitted the signal.
widget
The gtk:widget overlay widget to position.
allocation
Return location of type gdk:rectangle for the allocation.
Returns
True if allocation has been filled.
The signal is emitted to determine the position and size of any overlay widgets. A handler for this signal should fill allocation with the desired position and size for widget, relative to the main child of the overlay. The default handler for this signal uses the halign and valign properties of the widget 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 gtk:scrolled-window widget, the overlays are placed relative to its contents.
 

Returned by

Slot Access Functions

Inherited Slot Access Functions

2024-10-2