SOverlay

Implements an overlay widget.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

SlateCore

Header

/Engine/Source/Runtime/SlateCore/Public/Widgets/SOverlay.h

Include

#include "Widgets/SOverlay.h"

Syntax

class SOverlay : public SPanel

Remarks

Implements an overlay widget.

Overlay widgets allow for layering several widgets on top of each other. Each slot of an overlay represents a layer that can contain one widget. The slots will be rendered on top of each other in the order they are declared in code.

Usage: SNew(SOverlay)

  • SOverlay::Slot(SNew(SMyWidget1))

  • SOverlay::Slot(SNew(SMyWidget2))

  • SOverlay::Slot(SNew(SMyWidget3))

that SWidget3 will be drawn on top of SWidget2 and SWidget1.

Variables

Name Description

Protected variable

TPanelChildren<...

 

Children

The SOverlay's slots; each slot contains a child widget.

Constructors

Name Description

Public function

SOverlay()

Functions

Name Description

Public function

FScopedWidge...

 

AddSlot

(
    int32 ZOrder
)

Adds a slot at the specified location (ignores Z-order)

Public function

void

 

ClearChildren()

Removes all children from the overlay

Public function

void

 

Construct

(
    const FArguments& InArgs
)

Construct this widget.

Public function Const

int32

 

GetNumWidgets()

Returns the number of child widgets

Public function

bool

 

RemoveSlot

(
    TSharedRef< SWidget > Widget
)

Removes a widget from this overlay.

Public function

void

 

RemoveSlot

(
    int32 ZOrder
)

Removes a slot at the specified location

Public function Static

FOverlaySlot...

 

Slot()

Public function Static

const FSlate...

 

StaticWidgetClass()

Overridden from SWidget

Name Description

Protected function Virtual Const

FVector2D

 

ComputeDesiredSize

(
    float
)

A Panel's desired size in the space required to arrange of its children on the screen while respecting all of the children's desired sizes and any layout-related options specified by the user.

Public function Virtual

FChildren &#...

 

GetChildren()

All widgets must provide a way to access their children in a layout-agnostic way.

Public function Virtual Const

void

 

OnArrangeChildren

(
    const FGeometry& AllottedGeometry,
    FArrangedChildren& ArrangedChildre...
)

Panels arrange their children in a space described by the AllottedGeometry parameter.

Public function Virtual Const

int32

 

OnPaint

(
    const FPaintArgs& Args,
    const FGeometry& AllottedGeometry,
    const FSlateRect& MyCullingRect,
    FSlateWindowElementList& OutDrawEl...,
    int32 LayerId,
    const FWidgetStyle& InWidgetStyle,
    bool bParentEnabled
)

The widget should respond by populating the OutDrawElements array with FDrawElements that represent it and any of its children.

Overridden from FSlateControlledConstruction

Name Description

Public function Virtual Const

const FSlate...

 

GetWidgetClass()

Classes

Name

Description

Public struct

FArguments

Public class

FOverlaySlot

A slot that support alignment of content and padding and z-order

Typedefs