Gtk.Overlay¶
- 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 |
|
|
|
|
|
|
|
|
Virtual Methods¶
|
Properties¶
- Inherited:
Child Properties¶
Name |
Type |
Default |
Flags |
Short Description |
---|---|---|---|---|
|
|
r/w |
The index of the overlay in the parent, -1 for the main child |
|
|
r/w |
Pass through input, does not affect main child |
Style Properties¶
- Inherited:
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Gtk.Overlay(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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 itsGtk.Widget
:halign
andGtk.Widget
:valign
properties. E.g. a widget with both alignments set toGtk.Align.START
will be placed at the top left corner of theGtk.Overlay
container, whereas an overlay with halign set toGtk.Align.CENTER
and valign set toGtk.Align.END
will be placed a the bottom edge of theGtk.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.
The
Gtk.Overlay
implementation of theGtk.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:
Creates a new
Gtk.Overlay
.New in version 3.2.
- add_overlay(widget)[source]¶
- Parameters:
widget (
Gtk.Widget
) – aGtk.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
andGtk.Widget
:valign
properties.New in version 3.2.
- get_overlay_pass_through(widget)[source]¶
- Parameters:
widget (
Gtk.Widget
) – an overlay child ofGtk.Overlay
- Returns:
whether the widget is a pass through child.
- Return type:
Convenience function to get the value of the
Gtk.Overlay
:pass-through
child property for widget.New in version 3.18.
- reorder_overlay(child, index_)[source]¶
- Parameters:
child (
Gtk.Widget
) – the overlaidGtk.Widget
to moveindex (
int
) – the new index for child in the list of overlay children of self, starting from 0. If negative, indicates the end of the list
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:
widget (
Gtk.Widget
) – an overlay child ofGtk.Overlay
pass_through (
bool
) – whether the child should pass the input through
Convenience function to set the value of the
Gtk.Overlay
:pass-through
child property for widget.New in version 3.18.
- do_get_child_position(widget, allocation) virtual¶
- Parameters:
widget (
Gtk.Widget
) –allocation (
Gdk.Rectangle
) –
- Return type:
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:
- Parameters:
overlay (
Gtk.Overlay
) – The object which received the signalwidget (
Gtk.Widget
) – the child widget to position
- 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.