SScaleBox

Allows you to place content with a desired size and have it scale to meet the constraints placed on this box's alloted area.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Slate

Header

/Engine/Source/Runtime/Slate/Public/Widgets/Layout/SScaleBox.h

Include

#include "Widgets/Layout/SScaleBox.h"

Syntax

class SScaleBox : public SCompoundWidget

Remarks

Allows you to place content with a desired size and have it scale to meet the constraints placed on this box's alloted area. If you needed to have a background image scale to fill an area but not become distorted with different aspect ratios, or if you need to auto fit some text to an area, this is the control for you.

Variables

Name Description

Protected variable

TOptional< floa...

 

ComputedContentScale

Protected variable

TAttribute< boo...

 

IgnoreInheritedScale

Optional bool to ignore the inherited scale

Protected variable

TOptional< FVec...

 

LastAllocatedArea

Protected variable

FVector2D

 

LastFinalOffset

Protected variable

TOptional< FGeo...

 

LastPaintGeometry

Protected variable

FVector2D

 

LastSlotWidgetDesiredSize

Protected variable

TOptional< FVec...

 

NormalizedContentDesiredSize

Protected variable

FDelegateHandle

 

OnSafeFrameChangedHandle

Delegate handle to unhook the safe frame changed.

Protected variable

TOptional< FVec...

 

OverrideScreenSize

Protected variable

float

 

SafeZoneScale

Computed scale when scaled by safe zone padding

Protected variable

TAttribute< ESt...

 

Stretch

The method of scaling that is applied to the content.

Protected variable

TAttribute< ESt...

 

StretchDirection

The allowed direction of stretching of the content

Protected variable

TAttribute< flo...

 

UserSpecifiedScale

Optional scale that can be specified by the User

Constructors

Name Description

Public function

SScaleBox()

Constructor

Destructors

Name Description

Public function Virtual

~SScaleBox()

Functions

Name Description

Protected function Const

float

 

ComputeContentScale

(
    const FGeometry& PaintGeometry
)

Public function

void

 

Construct

(
    const FArguments& InArgs
)

Protected function

void

 

DebugSafeAreaUpdated

(
    const FMargin& NewSafeZone,
    bool bShouldRecacheMetrics
)

Protected function Const

bool

 

DoesScaleRequireNormalizingPrepassOrLocalGeometry()

Protected function Const

bool

 

IsDesiredSizeDependentOnAreaAndScale()

Protected function

void

 

RefreshSafeZoneScale()

Public function

void

 

SetContent

(
    TSharedRef< SWidget > InContent
)

See Content slot

Public function

void

 

SetHAlign

(
    EHorizontalAlignment HAlign
)

See HAlign argument

Public function

void

 

SetIgnoreInheritedScale

(
    bool InIgnoreInheritedScale
)

Set IgnoreInheritedScale argument

Public function

void

 

SetOverrideScreenInformation

(
    TOptional< FVector2D > InScreenSize
)

Public function

void

 

SetStretch

(
    EStretch::Type InStretch
)

See Stretch argument

Public function

void

 

SetStretchDirection

(
    EStretchDirection::Type InStretchDi...
)

See StretchDirection argument

Public function

void

 

SetUserSpecifiedScale

(
    float InUserSpecifiedScale
)

See UserSpecifiedScale argument

Public function

void

 

SetVAlign

(
    EVerticalAlignment VAlign
)

See VAlign argument

Overridden from SWidget

Name Description

Protected function Virtual Const

FVector2D

 

ComputeDesiredSize

(
    float LayoutScaleMultiplier
)

Compute the ideal size necessary to display this widget.

Protected function Virtual

bool

 

CustomPrepass

(
    float LayoutScaleMultiplier
)

Protected function Virtual Const

float

 

GetRelativeLayoutScale

(
    int32 ChildIndex,
    float LayoutScaleMultiplier
)

What is the Child's scale relative to this widget.

Public function Virtual Const

void

 

OnArrangeChildren

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

Compute the Geometry of all the children and add populate the ArrangedChildren list with their values.

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.

Classes

Name

Description

Public struct

FArguments

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss