SWindow

[SWindow](API\Runtime\SlateCore\Widgets\SWindow) is a platform-agnostic representation of a top-level window.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

SlateCore

Header

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

Include

#include "Widgets/SWindow.h"

Syntax

class SWindow : public SCompoundWidget

Remarks

SWindow is a platform-agnostic representation of a top-level window.

Variables

Name Description

Protected variable

EAutoCenter

 

AutoCenterRule

How to auto center the window

Protected variable

bool: 1

 

bCreateTitleBar

True if this window has a title bar

Protected variable

bool

 

bDragAnywhere

When true, grabbing anywhere on the window will allow it to be dragged.

Protected variable

bool: 1

 

bFocusWhenFirstShown

Focus this window immediately as it is shown

Protected variable

bool: 1

 

bHasCloseButton

True if this window displays an enabled close button on the toolbar area

Protected variable

bool: 1

 

bHasEverBeenShown

True if this window has been shown yet

Protected variable

bool: 1

 

bHasMaximizeButton

True if this window displays an enabled maximize button on the toolbar area

Protected variable

bool: 1

 

bHasMinimizeButton

True if this window displays an enabled minimize button on the toolbar area

Protected variable

bool: 1

 

bHasOSWindowBorder

True if this window displays the os window border instead of drawing one in slate

Protected variable

bool: 1

 

bHasSizingFrame

True if this window displays thick edge that can be used to resize the window

Protected variable

bool: 1

 

bInitiallyMaximized

True if this window is maximized when its created

Protected variable

bool: 1

 

bInitiallyMinimized

True if this window is minimized when its created

Protected variable

bool

 

bIsDrawingEnabled

Whether or not drawing is enabled for this window.

Protected variable

bool: 1

 

bIsMirrorWindow

True if the window is a mirror window for HMD content

Protected variable

bool: 1

 

bIsModalWindow

True if the window is modal

Protected variable

bool: 1

 

bIsPopupWindow

True if this is a pop up window

Protected variable

bool: 1

 

bIsTopmostWindow

True if this is a topmost window

Protected variable

bool: 1

 

bManualManageDPI

Protected variable

bool: 1

 

bShouldPreserveAspectRatio

True if the window should preserve its aspect ratio when resized by user

Protected variable

bool

 

bShouldShowWindowContentDuringOverlay

Whether or not we should show content of the window which could be occluded by full screen window content.

Protected variable

bool: 1

 

bSizeWillChangeOften

True if we expect the size of this window to change often, such as if its animated, or if it recycled for tool-tips, and we'd like to avoid costly GPU buffer resizes when that happens.

Protected variable

bool: 1

 

bVirtualWindow

True if this window is virtual and not directly rendered by slate application or the OS.

Protected variable

TArray< TShared...

 

ChildWindows

Child windows of this window

Protected variable

SVerticalBox::F...

 

ContentSlot

Protected variable

int32

 

ExpectedMaxHeight

The expected maximum height of the window.

Protected variable

int32

 

ExpectedMaxWidth

The expected maximum width of the window.

Protected variable

TSharedPtr< SWi...

 

FullWindowOverlayWidget

Full window overlay widget

Protected variable

TSharedRef< FHi...

 

HittestGrid

Each window has its own hittest grid for accelerated widget picking.

Protected variable

FVector2D

 

InitialDesiredScreenPosition

Initial desired position of the window's content in screen space

Protected variable

FVector2D

 

InitialDesiredSize

Initial desired size of the window's content in screen space

Protected variable

FMargin

 

LayoutBorder

The padding for between the edges of the window and it's content.

Protected variable

SWindow::FMorph...

 

Morpher

Public variable

FSlateRect

 

MoveResizeRect

Public variable

FVector2D

 

MoveResizeStart

Public variable

EWindowZone::Ty...

 

MoveResizeZone

Used to store the zone where the mouse down event occurred during move / drag

Protected variable

TSharedPtr< FGe...

 

NativeWindow

The native window that is backing this Slate Window

Protected variable

FOnWindowActiva...

 

OnWindowActivated

Invoked when the window has been activated.

Protected variable

FOnWindowClosed

 

OnWindowClosed

Invoked when the window is about to be closed.

Protected variable

FOnWindowDeacti...

 

OnWindowDeactivated

Invoked when the window has been deactivated.

Protected variable

FOnWindowMoved

 

OnWindowMoved

Invoked when the window is moved

Protected variable

FOnSwitchWorldH...

 

OnWorldSwitchHack

World switch delegate

Protected variable

float

 

Opacity

Current opacity of the window

Protected variable

TWeakPtr< SWind...

 

ParentWindowPtr

When not null, this window will always appear on top of the parent and be closed when the parent is closed.

Protected variable

TSharedPtr< cla...

 

PopupLayer

This layer provides mechanism for tooltips, drag-drop decorators, and popups without creating a new window.

Protected variable

FVector2D

 

PreFullscreenPosition

The position of the window before entering fullscreen

Protected variable

FRequestDestroy...

 

RequestDestroyWindowOverride

Invoked when the window is requested to be destroyed.

Protected variable

FVector2D

 

ScreenPosition

Position of the window's content in screen space

Protected variable

FVector2D

 

Size

Size of the window's content area in screen space

Protected variable

FWindowSizeLimi...

 

SizeLimits

Min and Max values for Width and Height; all optional.

Protected variable

ESizingRule

 

SizingRule

How to size the window

Protected variable

const FWindowSt...

 

Style

Style used to draw this window

Protected variable

TAttribute< FTe...

 

Title

Title of the window, displayed in the title bar as well as potentially in the task bar (Windows platform)

Protected variable

TSharedPtr< SWi...

 

TitleArea

Protected variable

TSharedPtr< IWi...

 

TitleBar

The window title bar.

Protected variable

float

 

TitleBarSize

Size of this window's title bar.

Protected variable

EWindowTranspar...

 

TransparencySupport

Transparency setting for this window

Protected variable

EWindowType

 

Type

Type of the window

Protected variable

FMargin

 

UserResizeBorder

The margin around the edges of the window that will be detected as places the user can grab to resize the window.

Protected variable

TWeakPtr< ISlat...

 

Viewport

Pointer to the viewport registered with this window if any

Protected variable

FVector2D

 

ViewportSize

Size of the viewport. If (0,0) then it is equal to Size

Protected variable

TWeakPtr< SWidg...

 

WidgetFocusedOnDeactivate

Widget that had keyboard focus when this window was last de-activated, if any.

Protected variable

TWeakPtr< SWidg...

 

WidgetToFocusOnActivate

Widget to transfer keyboard focus to when this window becomes active, if any.

Protected variable

FOnWindowActiva...

 

WindowActivatedEvent

Protected variable

EWindowActivati...

 

WindowActivationPolicy

When should the window be activated upon being shown

Protected variable

const FSlateBru...

 

WindowBackground

Protected variable

FOnWindowClosed...

 

WindowClosedEvent

Protected variable

FOnWindowDeacti...

 

WindowDeactivatedEvent

Protected variable

TSharedPtr< SOv...

 

WindowOverlay

Window overlay widget

Protected variable

EWindowZone::Ty...

 

WindowZone

Cached "zone" the cursor was over in the window the last time that someone called GetCurrentWindowZone()

Constructors

Name Description

Public function

SWindow()

Default constructor.

Functions

Name Description

Public function Const

bool

 

AcceptsInput()

Public function Const

EWindowActiv...

 

ActivationPolicy()

Public function

void

 

AddChildWindow

(
    const TSharedRef< SWindow >& Child...
)

Add ChildWindow as this window's child

Public function

SOverlay::FO...

 

AddOverlaySlot

(
    const int32 ZOrder
)

Adds content to draw on top of the entire window

Public function

FPopupLayerS...

 

AddPopupLayerSlot()

Return a new slot in the popup layer. Assumes that the window has a popup layer.

Public function Const

bool

 

AppearsInTaskbar()

Public function

void

 

BeginFullWindowOverlayTransition()

Begins a transition from showing regular window content to overlay content During the transition we show both sets of content

Public function

void

 

BringToFront

(
    bool bForce
)

Bring the window to the front

Public function Static

FVector2D

 

ComputeWindowSizeForContent

(
    FVector2D ContentSize
)

Public function

void

 

Construct

(
    const FArguments& InArgs
)

Protected function

void

 

ConstructWindowInternals()

Public function

void

 

DestroyWindowImmediately()

Warning: use Request Destroy Window whenever possible! This method destroys the window immediately!

Public function

void

 

DrawAttention

(
    const FWindowDrawAttentionParameter...
)

Attempts to draw the user's attention to this window in whatever way is appropriate for the platform if this window is not the current active

Public function

void

 

EnableWindow

(
    bool bEnable
)

Enables or disables this window and all of its children

Public function

void

 

EndFullWindowOverlayTransition()

Ends a transition from showing regular window content to overlay content When this is called content occluded by the full window overlay(if there is one) will be physically hidden

Public function

void

 

FlashWindow()

Flashed the window, used for drawing attention to modal dialogs

Public function

TArray< TSha...

 

GetChildWindows()

Public function Const

const TArray...

 

GetChildWindows()

Public function Const

FSlateRect

 

GetClientRectInScreen()

Public function Const

FVector2D

 

GetClientSizeInScreen()

Public function Const

FSlateRect

 

GetClippingRectangleInWindow()

Public function Const

TSharedRef< ...

 

GetContent()

Gets the widget content for this window

Public function

int32

 

GetCornerRadius()

Public function

EWindowZone:...

 

GetCurrentWindowZone

(
    FVector2D LocalMousePosition
)

Gets the current Window Zone that mouse position is over.

Public function Const

FVector2D

 

GetDesiredSizeDesktopPixels()

Public function Const

float

 

GetDPIScaleFactor()

Returns the DPI scale factor of the native window

Public function Const

int32

 

GetExpectedMaxHeight()

Public function Const

int32

 

GetExpectedMaxWidth()

Public function Const

FSlateRect

 

GetFullScreenInfo()

Returns the rectangle of the screen the window is associated with

Public function

TSharedRef< ...

 

GetHittestGrid()

Access the hittest acceleration data structure for this window.

Public function Const

FVector2D

 

GetInitialDesiredPositionInScreen()

Public function Const

FVector2D

 

GetInitialDesiredSizeInScreen()

Public function Const

FSlateLayout...

 

GetLocalToScreenTransform()

Public function Const

FSlateLayout...

 

GetLocalToWindowTransform()

Public function Const

FVector2D

 

GetMorphTargetPosition()

Public function Const

FSlateRect

 

GetMorphTargetShape()

Public function Const

TSharedPtr< ...

 

GetNativeWindow()

Public function

TSharedPtr< ...

 

GetNativeWindow()

Public function Const

FSlateRect

 

GetNonMaximizedRectInScreen()

Public function Const

FMargin

 

GetNonMaximizedWindowBorderSize()

Returns the margins used for the window border if it's not maximized

Public function

FOnWindowAct...

 

GetOnWindowActivatedEvent()

Gets the multicast delegate executed when the window is deactivated

Public function

FOnWindowClo...

 

GetOnWindowClosedEvent()

Gets the multicast delegate to execute right before the window is closed

Public function

FOnWindowDea...

 

GetOnWindowDeactivatedEvent()

Gets the multicast delegate executed when the window is deactivated

Public function Const

float

 

GetOpacity()

Public function Const

TSharedPtr< ...

 

GetParentWindow()

Public function Const

FVector2D

 

GetPositionInScreen()

Public function Const

FSlateRect

 

GetRectInScreen()

Public function Const

FVector2D

 

GetSizeInScreen()

Public function Const

FWindowSizeL...

 

GetSizeLimits()

Optional constraints on min and max sizes that this window can be.

Public function Const

FText

 

GetTitle()

Grabs the current window title

Protected function Virtual

EHorizontalA...

 

GetTitleAlignment()

Returns the alignment type for the titlebar's title text.

Public function Const

FOptionalSiz...

 

GetTitleBarSize()

Returns the size of the title bar as a Slate size parameter.

Public function

TSharedPtr< ...

 

GetTopmostAncestor()

Look up the parent chain until we find the top-level window that owns this window

Public function Const

EWindowTrans...

 

GetTransparencySupport()

Public function Const

EWindowType

 

GetType()

Grabs the window type

Public function

TSharedPtr< ...

 

GetViewport()

Public function Const

FVector2D

 

GetViewportSize()

Returns the viewport size, taking into consideration if the window size should drive the viewport size

Protected function Const

const FSlate...

 

GetWindowBackground()

Get the brush used to draw the window background

Protected function Const

FSlateColor

 

GetWindowBackgroundColor()

Get the color used to tint the window background

Public function Const

FMargin

 

GetWindowBorderSize

(
    bool bIncTitleBar
)

Returns the margins used for the window border. This varies based on whether it's maximized or not.

Public function Const

FGeometry

 

GetWindowGeometryInScreen()

Get the Geometry that describes this window.

Public function Const

FGeometry

 

GetWindowGeometryInWindow()

Public function Const

EWindowMode:...

 

GetWindowMode()

Protected function Const

const FSlate...

 

GetWindowOutline()

Get the brush used to draw the window outline

Protected function Const

FSlateColor

 

GetWindowOutlineColor()

Get the color used to tint the window outline

Public function

FVector2D

 

GetWindowSizeFromClientSize

(
    FVector2D InClientSize
)

For a given client size, calculate the window size required to accomodate any potential non-OS borders and tilebars.

Protected function Const

FSlateColor

 

GetWindowTitleContentColor()

Get the desired color of titlebar items. These change during flashing.

Public function Const

EVisibility

 

GetWindowVisibility()

Windows that are not hittestable should not show up in the hittest grid.

Public function

void

 

HACK_ForceToFront()

Force a window to front even if a different application is in front.

Public function Const

bool

 

HasActiveChildren()

Are any of our child windows active?

Public function Const

bool

 

HasActiveParent()

Are any of our parent windows active?

Public function Const

bool

 

HasCloseBox()

Public function Const

bool

 

HasFullWindowOverlayContent()

Checks to see if there is content assigned as a full window overlay

Public function Const

bool

 

HasMaximizeBox()

Public function Const

bool

 

HasMinimizeBox()

Public function Const

bool

 

HasOSWindowBorder()

Public function Const

bool

 

HasOverlay()

Check whether we have a full window overlay, used to draw content over the entire window.

Public function Const

bool

 

HasSizingFrame()

Public function

void

 

HideWindow()

Make the window invisible

Public function

void

 

InitialMaximize()

Maximize the window if bInitiallyMaximized is set

Public function

void

 

InitialMinimize()

Maximize the window if bInitiallyMinimized is set

Public function Const

bool

 

IsActive()

Is this window active?

Are any of our child windows active?

Public function Const

bool

 

IsAutosized()

Public function Const

bool

 

IsDescendantOf

(
    const TSharedPtr< SWindow >& Paren...
)

Returns whether or not this window is a descendant of the specfied parent window

Public function Const

bool

 

IsDrawingEnabled()

Public function Const

bool

 

IsFocusedInitially()

Public function Const

bool

 

IsManualManageDPIChanges()

Public function

bool

 

IsMirrorWindow()

Public function

bool

 

IsModalWindow()

Public function Const

bool

 

IsMorphing()

Public function Const

bool

 

IsMorphingSize()

Public function Const

bool

 

IsRegularWindow()

Public function Const

bool

 

IsScreenspaceMouseWithin

(
    FVector2D ScreenspaceMouseCoordinat...
)

Public function Const

bool

 

IsTopmostWindow()

Public function Const

bool

 

IsUserSized()

Public function Const

bool

 

IsViewportSizeDrivenByWindow()

Returns whether or not the viewport and window size should be linked together.

Public function Const

bool

 

IsVirtualWindow()

Public function Const

bool

 

IsVisible()

Public function Const

bool

 

IsWindowMaximized()

Public function Const

bool

 

IsWindowMinimized()

Public function Static

TSharedRef< ...

 

MakeCursorDecorator()

Make cursor decorator window

Public function Static

TSharedRef< ...

 

MakeNotificationWindow()

Make a notification window

Public function Static

TSharedRef< ...

 

MakeToolTipWindow()

Make a tool tip window

Protected function Virtual

TSharedRef< ...

 

MakeWindowTitleBar

(
    const TSharedRef< SWindow >& Windo...,
    const TSharedPtr< SWidget >& Cente...,
    EHorizontalAlignment CenterContentA...
)

Returns swindow title bar widgets.

Public function

void

 

Maximize()

Windows functions

Public function

void

 

Minimize()

Public function

void

 

MorphToPosition

(
    const FCurveSequence& Sequence,
    const float TargetOpacity,
    const FVector2D& TargetPosition
)

Animate the window to TargetOpacity and TargetPosition over a short period of time

Public function

void

 

MorphToShape

(
    const FCurveSequence& Sequence,
    const float TargetOpacity,
    const FSlateRect& TargetShape
)

Animate the window to TargetOpacity and TargetShape over a short period of time

Public function

void

 

MoveWindowTo

(
    FVector2D NewPosition
)

Relocate the window to a screenspace position specified by NewPosition

Public function

void

 

NotifyWindowBeingDestroyed()

Calls the OnWindowClosed delegate when this window is about to be closed

Public function Virtual

bool

 

OnIsActiveChanged

(
    const FWindowActivateEvent& Activa...
)

The system will call this method to notify the window that it has been places in the foreground or background.

Public function Const

int32

 

PaintWindow

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

Paint the window and all of its contents.

Public function

bool

 

RemoveDescendantWindow

(
    const TSharedRef< SWindow >& Desce...
)

Remove DescendantToRemove from this window's children or their children.

Public function

void

 

RemoveOverlaySlot

(
    const TSharedRef< SWidget >& InCon...
)

Removes a widget that is being drawn over the entire window

Public function

void

 

RemovePopupLayerSlot

(
    const TSharedRef< SWidget >& Widge...
)

Counterpart to AddPopupLayerSlot

Public function

void

 

RequestDestroyWindow()

Request that this window be destroyed.

Public function

void

 

ReshapeWindow

(
    const FSlateRect& InNewShape
)

Relocate the window to a screenspace position specified by NewPosition and resize it to NewSize

Public function

void

 

ReshapeWindow

(
    FVector2D NewPosition,
    FVector2D NewSize
)

Relocate the window to a screenspace position specified by NewPosition and resize it to NewSize

Public function

void

 

Resize

(
    FVector2D NewSize
)

Resize the window to be NewSize immediately

Public function

void

 

Restore()

Public function

void

 

SetAsModalWindow()

Set modal window related flags - called by Slate app code during FSlateApplication::AddModalWindow()

Public function

void

 

SetCachedScreenPosition

(
    FVector2D NewPosition
)

Sets the actual screen position of the window. THIS SHOULD ONLY BE CALLED BY THE OS

Public function

void

 

SetCachedSize

(
    FVector2D NewSize
)

Sets the actual size of the window. THIS SHOULD ONLY BE CALLED BY THE OS

Public function

void

 

SetContent

(
    TSharedRef< SWidget > InContent
)

Sets the widget content for this window

Public function

void

 

SetDPIScaleFactor

(
    const float Factor
)

Overrides the DPI scale factor of the native window

Public function

void

 

SetFullWindowOverlayContent

(
    TSharedPtr< SWidget > InContent
)

Sets a widget to use as a full window overlay, or clears an existing widget if set.

Public function

void

 

SetIndependentViewportSize

(
    const FVector2D& VP
)

Sets the viewport size independently of the window size, if non-zero.

Public function

void

 

SetManualManageDPIChanges

(
    const bool bManualDPI
)

Will inform the native window that we need to handle any DPI changes from within the application

Public function

void

 

SetMirrorWindow

(
    bool bSetMirrorWindow
)

Set mirror window flag

Public function

void

 

SetNativeWindow

(
    TSharedRef< FGenericWindow > InNati...
)

Sets the native OS window associated with this SWindow

Public function

void

 

SetNativeWindowButtonsVisibility

(
    bool bVisible
)

Shows or hides native window buttons on platforms that use them

Public function

void

 

SetOnWindowClosed

(
    const FOnWindowClosed& InDelegate
)

Sets the delegate to execute right before the window is closed

Public function

void

 

SetOnWindowMoved

(
    const FOnWindowMoved& InDelegate
)

Sets the delegate to execute right after the window has been moved

Public function

void

 

SetOnWorldSwitchHack

(
    FOnSwitchWorldHack& InOnWorldSwitc...
)

Sets the delegate to call when switching worlds in before ticking,drawing, or sending messages to widgets in this window

Public function

void

 

SetOpacity

(
    const float InOpacity
)

Sets the opacity of this window

Public function

void

 

SetRequestDestroyWindowOverride

(
    const FRequestDestroyWindowOverride...
)

Sets the delegate to override RequestDestroyWindow

Public function

void

 

SetSizingRule

(
    ESizingRule InSizingRule
)

Should this window automatically derive its size based on its content or be user-drive?

Public function

void

 

SetTitle

(
    const FText& InTitle
)

Sets the current window title

Public function

void

 

SetTitleBar

(
    const TSharedPtr< IWindowTitleBar >...
)

Public function

void

 

SetViewport

(
    TSharedRef< ISlateViewport > Viewpo...
)

Public function

void

 

SetViewportSizeDrivenByWindow

(
    bool bDrivenByWindow
)

Sets whether or not the viewport size should be driven by the window's size.

Public function

void

 

SetWidgetToFocusOnActivate

(
    TSharedPtr< SWidget > InWidget
)

Sets a widget that should become focused when this window is next activated

Public function

void

 

SetWindowMode

(
    EWindowMode::Type WindowMode
)

Toggle window between window modes (fullscreen, windowed, etc)

Public function Const

bool

 

ShouldPreserveAspectRatio()

Public function

void

 

ShowWindow()

Make the window visible

Public function Const

bool

 

SizeWillChangeOften()

Protected function

void

 

StartMorph()

Kick off a morph to whatever the target shape happens to be.

Public function Const

int32

 

SwitchWorlds

(
    int32 WorldId
)

Hack to switch worlds

Public function

void

 

UpdateMorphTargetPosition

(
    const FVector2D& TargetPosition
)

Set a new morph position and force the morph to run for at least one frame in order to reach that target

Public function

void

 

UpdateMorphTargetShape

(
    const FSlateRect& TargetShape
)

Set a new morph shape and force the morph to run for at least one frame in order to reach that target

Overridden from SWidget

Name Description

Public function Virtual Const

bool

 

Advanced_IsWindow()

Is this widget derivative of SWindow

Public function Virtual

TSharedRef< ...

 

CreateAccessibleWidget()

Public function Virtual Const

FCursorReply

 

OnCursorQuery

(
    const FGeometry& MyGeometry,
    const FPointerEvent& CursorEvent
)

Events.

Public function Virtual

TSharedPtr< ...

 

OnVisualizePopup

(
    const TSharedRef< SWidget >& Popup...
)

Visualize a new pop-up if possible.

Public function Virtual

void

 

SetDefaultAccessibleText

(
    EAccessibleType AccessibleType
)

Assign AccessibleText with a default value that can be used when AccessibleBehavior is set to Auto or Custom.

Public function Virtual Const

bool

 

SupportsKeyboardFocus()

Checks to see if this widget supports keyboard focus. Override this in derived classes.

Public function Virtual

void

 

Tick

(
    const FGeometry& AllottedGeometry,
    const double InCurrentTime,
    const float InDeltaTime
)

Ticks this widget with Geometry.

Public function Virtual Const

FString

 

ToString()

Classes

Name

Description

Public struct

FArguments

Protected struct

FMorpher

Utility for animating the window size.

Deprecated Functions

Name Description

Public function Const

bool

 

ActivateWhenFirstShown()

ActivateWhenFirstShown() is deprecated. Please use ActivationPolicy() instead.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback