Gtk.Overlay - Classes - Gtk 3.0 (original) (raw)

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Bin Gtk.Bin Gtk.Overlay Gtk.Overlay Gtk.Bin->Gtk.Overlay Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Widget->Gtk.Container

Subclasses:

None

Methods

Inherited:

Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class new ()
add_overlay (widget)
get_overlay_pass_through (widget)
reorder_overlay (child, index_)
set_overlay_pass_through (widget, pass_through)

Virtual Methods

Inherited:

Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

do_get_child_position (widget, allocation)

Properties

Inherited:

Gtk.Container (3), Gtk.Widget (39)

Child Properties

Name Type Default Flags Short Description
index int 0 r/w The index of the overlay in the parent, -1 for the main child
pass-through bool False r/w Pass through input, does not affect main child

Style Properties

Inherited:

Gtk.Widget (17)

Signals

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name Short Description
get-child-position The ::get-child-position signal is emitted to determine the position and size of any overlay child widgets.

Fields

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name Type Access Description
parent Gtk.Bin r

Class Details

class Gtk.Overlay(**kwargs)

Bases:

Gtk.Bin

Abstract:

No

Structure:

Gtk.OverlayClass

Gtk.Overlay is a container which contains a single main child, on top of which it can place “overlay” widgets. The position of each overlay widget is determined by its Gtk.Widget :halign and Gtk.Widget :valignproperties. E.g. a widget with both alignments set to Gtk.Align.STARTwill be placed at the top left corner of the Gtk.Overlay container, whereas an overlay with halign set to Gtk.Align.CENTER and valign set to Gtk.Align.END will be placed a the bottom edge of the Gtk.Overlay, 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 Gtk.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.

Gtk.Overlay as Gtk.Buildable

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

CSS nodes

Gtk.Overlay 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.

classmethod new()[source]

Returns:

a new Gtk.Overlay object.

Return type:

Gtk.Widget

Creates a new Gtk.Overlay.

New in version 3.2.

add_overlay(widget)[source]

Parameters:

widget (Gtk.Widget) – a Gtk.Widget to be added to the container

Adds widget to self.

The widget will be stacked on top of the main widget added with Gtk.Container.add().

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

New in version 3.2.

get_overlay_pass_through(widget)[source]

Parameters:

widget (Gtk.Widget) – an overlay child of Gtk.Overlay

Returns:

whether the widget is a pass through child.

Return type:

bool

Convenience function to get the value of the Gtk.Overlay :pass-throughchild property for widget.

New in version 3.18.

reorder_overlay(child, index_)[source]

Parameters:

Moves child to a new index in the list of self children. The list contains overlays in the order that these were added to self by default. See also Gtk.Overlay :index.

A widget’s index in the self children list determines which order the children are drawn if they overlap. The first child is drawn at the bottom. It also affects the default focus chain order.

New in version 3.18.

set_overlay_pass_through(widget, pass_through)[source]

Parameters:

Convenience function to set the value of the Gtk.Overlay :pass-throughchild property for widget.

New in version 3.18.

do_get_child_position(widget, allocation) virtual

Parameters:

Return type:

bool

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

Signal Details

Gtk.Overlay.signals.get_child_position(overlay, widget)

Signal Name:

get-child-position

Flags:

RUN_LAST

Parameters:

Returns:

True if the allocation has been filled

allocation:

return location for the allocation

Return type:

(bool, allocation: Gdk.Rectangle)

The ::get-child-position signal is 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 Gtk.Align.FILL will cause the overlay to be full-width/height). If the main child is aGtk.ScrolledWindow, the overlays are placed relative to its contents.