1.137 <GtkOverlay>

Class: <GtkOverlay>

It derives from <GtkWidget>.

Places “overlay” widgets on top of a single main child.

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

More complicated placement of overlays is possible by connecting to the overlay:get-child-position! signal.

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

GtkOverlay as GtkBuildable

The <GtkOverlay> implementation of the <GtkBuildable> interface supports placing a child as an overlay by specifying “overlay” as the “type” attribute of a <child> element.

CSS nodes

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

Properties

Property: overlay:child self

The main child widget.

Its value is a <GtkWidget>, or #f.

Set it with (set! (overlay:child self) value).

Procedures

Method: overlay:add-overlay self widget
Method: add-overlay self widget

Adds widget to self.

The widget will be stacked on top of the main widget added with overlay:set-child.

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

self

Passed: a <GtkOverlay>.

a <GtkOverlay>

widget

Passed: a <GtkWidget>.

a <GtkWidget> to be added to the container

Method: overlay:get-child self ⇒ %return
Method: get-child self ⇒ %return

Gets the child widget of self.

self

Passed: a <GtkOverlay>.

a <GtkOverlay>

%return

Returned: a <GtkWidget>, or #f.

the child widget of self

Method: overlay:get-clip-overlay? self widget ⇒ %return
Method: get-clip-overlay? self widget ⇒ %return

Gets whether widget should be clipped within the parent.

self

Passed: a <GtkOverlay>.

a <GtkOverlay>

widget

Passed: a <GtkWidget>.

an overlay child of <GtkOverlay>

%return

Returned: a boolean.

whether the widget is clipped within the parent.

Method: overlay:get-measure-overlay? self widget ⇒ %return
Method: get-measure-overlay? self widget ⇒ %return

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

self

Passed: a <GtkOverlay>.

a <GtkOverlay>

widget

Passed: a <GtkWidget>.

an overlay child of <GtkOverlay>

%return

Returned: a boolean.

whether the widget is measured

Procedure: overlay:new ⇒ %return

Creates a new <GtkOverlay>.

%return

Returned: a <GtkWidget>.

a new <GtkOverlay> object.

Method: overlay:remove-overlay self widget
Method: remove-overlay self widget

Removes an overlay that was added with overlay:add-overlay.

self

Passed: a <GtkOverlay>.

a <GtkOverlay>

widget

Passed: a <GtkWidget>.

a <GtkWidget> to be removed

Method: overlay:set-child self [child]
Method: set-child self [child]

Sets the child widget of self.

self

Passed: a <GtkOverlay>.

a <GtkOverlay>

child

Passed, or left out: a <GtkWidget>, or #f.

the child widget

Method: overlay:set-clip-overlay self widget clip-overlay
Method: set-clip-overlay self widget clip-overlay

Sets whether widget should be clipped within the parent.

self

Passed: a <GtkOverlay>.

a <GtkOverlay>

widget

Passed: a <GtkWidget>.

an overlay child of <GtkOverlay>

clip-overlay

Passed: a boolean.

whether the child should be clipped

Method: overlay:set-measure-overlay self widget measure
Method: set-measure-overlay self widget measure

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

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

self

Passed: a <GtkOverlay>.

a <GtkOverlay>

widget

Passed: a <GtkWidget>.

an overlay child of <GtkOverlay>

measure

Passed: a boolean.

whether the child should be measured

Signals

Signal: overlay:get-child-position!

Connect a handler with (connect object overlay:get-child-position! handler). It is called as (handler self widget allocation) ⇒ %return.

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.

self

Passed: a <GtkOverlay>.

widget

Passed: a <GtkWidget>.

the child widget to position

allocation

Passed, for the procedure to fill in: a <GdkRectangle>.

return location for the allocation

%return

Returned: a boolean.

#t if the allocation has been filled