Class Overlay

All Implemented Interfaces:
PointerInterface

public class Overlay extends Widget
`GtkOverlay` is a container which contains a single main child, on top
of which it can place “overlay” widgets.

![An example GtkOverlay](overlay.png)

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 the `GtkOverlay` 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 `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 [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.

# 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.

https://docs.gtk.org/gtk4/class.Overlay.html

  • Field Details

  • Constructor Details

    • Overlay

      public Overlay(PointerContainer pointer)
    • Overlay

      public Overlay()
      Creates a new `GtkOverlay`.
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • addOverlay

      public void addOverlay(@Nonnull Widget widget)
      Adds @widget to @overlay.

      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.
      Parameters:
      widget - a `GtkWidget` to be added to the container
    • getChild

      public Widget getChild()
      Gets the child widget of @overlay.
      Returns:
      the child widget of @overlay
    • getClipOverlay

      public boolean getClipOverlay(@Nonnull Widget widget)
      Gets whether @widget should be clipped within the parent.
      Parameters:
      widget - an overlay child of `GtkOverlay`
      Returns:
      whether the widget is clipped within the parent.
    • getMeasureOverlay

      public boolean getMeasureOverlay(@Nonnull Widget widget)
      Gets whether @widget's size is included in the measurement of
      @overlay.
      Parameters:
      widget - an overlay child of `GtkOverlay`
      Returns:
      whether the widget is measured
    • removeOverlay

      public void removeOverlay(@Nonnull Widget widget)
      Removes an overlay that was added with gtk_overlay_add_overlay().
      Parameters:
      widget - a `GtkWidget` to be removed
    • setChild

      public void setChild(@Nullable Widget child)
      Sets the child widget of @overlay.
      Parameters:
      child - the child widget
    • setClipOverlay

      public void setClipOverlay(@Nonnull Widget widget, boolean clip_overlay)
      Sets whether @widget should be clipped within the parent.
      Parameters:
      widget - an overlay child of `GtkOverlay`
      clip_overlay - whether the child should be clipped
    • setMeasureOverlay

      public void setMeasureOverlay(@Nonnull Widget widget, boolean measure)
      Sets whether @widget is included in the measured size of @overlay.

      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 @overlay's allocation if they are too large.
      Parameters:
      widget - an overlay child of `GtkOverlay`
      measure - whether the child should be measured
    • onGetChildPosition

      public SignalHandler onGetChildPosition(Overlay.OnGetChildPosition signal)
      Connect to signal "get-child-position".
      See Overlay.OnGetChildPosition.onGetChildPosition(ch.bailu.gtk.gtk.Widget, ch.bailu.gtk.gdk.Rectangle) for signal description.
      Field SIGNAL_ON_GET_CHILD_POSITION contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Overrides:
      asAccessible in class Widget
      Returns:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Overrides:
      asBuildable in class Widget
      Returns:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Overrides:
      asConstraintTarget in class Widget
      Returns:
      ConstraintTarget
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()