Gtk.Overlay¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted to determine the position and size of any overlay child widgets. |
Fields¶
- Inherited:
Class Details¶
- class Gtk.Overlay(**kwargs)¶
- Bases:
- Abstract:
No
GtkOverlay
is a container which contains a single main child, on top of which it can place “overlay” widgets.An example
Gtk.Overlay
The position of each overlay widget is determined by its [property`Gtk`.Widget:halign] and [property`Gtk`.Widget:valign] properties. E.g. a widget with both alignments set to
Gtk.Align.START
will be placed at the top left corner of theGtkOverlay
container, whereas an overlay with halign set toGtk.Align.CENTER
and valign set toGtk.Align.END
will be placed a the bottom edge of theGtkOverlay
, 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 [signal`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
GtkOverlay
implementation of theGtkBuildable
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.- add_overlay(widget)[source]¶
- Parameters:
widget (
Gtk.Widget
) – aGtkWidget
to be added to the container
Adds widget to self.
The widget will be stacked on top of the main widget added with [method`Gtk`.Overlay.set_child].
The position at which widget is placed is determined from its [property`Gtk`.Widget:halign] and [property`Gtk`.Widget:valign] properties.
- get_child()[source]¶
- Returns:
the child widget of self
- Return type:
Gtk.Widget
orNone
Gets the child widget of self.
- get_clip_overlay(widget)[source]¶
- Parameters:
widget (
Gtk.Widget
) – an overlay child ofGtkOverlay
- Returns:
whether the widget is clipped within the parent.
- Return type:
Gets whether widget should be clipped within the parent.
- get_measure_overlay(widget)[source]¶
- Parameters:
widget (
Gtk.Widget
) – an overlay child ofGtkOverlay
- Returns:
whether the widget is measured
- Return type:
Gets whether widget's size is included in the measurement of self.
- remove_overlay(widget)[source]¶
- Parameters:
widget (
Gtk.Widget
) – aGtkWidget
to be removed
Removes an overlay that was added with
Gtk.Overlay.add_overlay
().
- set_child(child)[source]¶
- Parameters:
child (
Gtk.Widget
orNone
) – the child widget
Sets the child widget of self.
- set_clip_overlay(widget, clip_overlay)[source]¶
- Parameters:
widget (
Gtk.Widget
) – an overlay child ofGtkOverlay
clip_overlay (
bool
) – whether the child should be clipped
Sets whether widget should be clipped within the parent.
- set_measure_overlay(widget, measure)[source]¶
- Parameters:
widget (
Gtk.Widget
) – an overlay child ofGtkOverlay
measure (
bool
) – whether the child should be measured
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
True
. Children who are not included may be drawn outside of self's allocation if they are too large.
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
)
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 aGtkScrolledWindow
, the overlays are placed relative to its contents.
Property Details¶
- Gtk.Overlay.props.child¶
- Name:
child
- Type:
- Default Value:
- Flags:
The main child widget.