SMenuAnchor

A PopupAnchor summons a Popup relative to its content.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Slate

Header

/Engine/Source/Runtime/Slate/Public/Widgets/Input/SMenuAnchor.h

Include

#include "Widgets/Input/SMenuAnchor.h"

Syntax

class SMenuAnchor :
    public SPanel ,
    public IMenuHost

Remarks

A PopupAnchor summons a Popup relative to its content. Summoning a popup relative to the cursor is accomplished via the application.

Variables

Name Description

Protected variable

bool

 

bApplyWidgetStyleToMenu

Should we paint the popup using the received InWidgetStyle?

Protected variable

bool

 

bDismissedThisTick

Was the menu just dismissed this tick?

Protected variable

bool

 

bFitInWindow

Should the menu anchor fit inside the window?

Protected variable

bool

 

bIsCollapsedByParent

Whether this menu should be collapsed when its parent gets focus

Protected variable

bool

 

bShouldDeferPaintingAfterWindowContent

Should the menu content painting be deferred? If not, the menu content will layer over the menu anchor, rather than above all window contents.

Protected variable

bool

 

bUseApplicationMenuStack

Should the menu by created by the application stack code making it behave like and have the lifetime of a normal menu?

Protected variable

TPanelChildren <...

 

Children

The currently arranged children in the menu anchor.

Protected variable

FVector2D

 

LocalPopupPosition

Protected variable

TSharedPtr < SWi ...

 

MenuContent

Static menu content to use when the delegate used when OnGetMenuContent is not defined.

Protected variable

TOptional < EPop ...

 

Method

Should we summon a new window for this popup or

Protected variable

FPopupMethodRep ...

 

MethodInUse

Method currently being used to show the popup. No value if popup is closed.

Protected variable

FOnGetContent

 

OnGetMenuContent

Callback invoked when the popup is being summoned

Protected variable

FOnIsOpenChange ...

 

OnMenuOpenChanged

Callback invoked when the popup is being opened/closed

Protected variable

TSharedPtr < IMe ...

 

OwnedMenuPtr

An interface pointer to the menu object presenting this popup.

Protected variable

TAttribute < EMe ...

 

Placement

How should the popup be placed relative to the anchor.

Protected variable

TWeakPtr < IMenu ...

 

PopupMenuPtr

An interface pointer to the menu object presenting this popup.

Protected variable

TWeakPtr < SWind ...

 

PopupWindowPtr

A pointer to the window presenting this popup.

Protected variable

FVector2D

 

ScreenPopupPosition

Screen-space version of LocalPopupPosition, also cached in Tick.

Protected variable

TSharedPtr < SWi ...

 

WrappedContent

MenuContent plus any extra wrapping widgets needed by the menu infrastructure.

Constructors

Name Description

Public function

SMenuAnchor()

Destructors

Name Description

Public function Virtual

~SMenuAnchor()

Functions

Name Description

Protected function Const

FGeometry

 

ComputeNewWindowMenuPlacement

(
    const FGeometry & AllottedGeometry,
    const FVector2D & PopupDesiredSize,
    EMenuPlacement PlacementMode
)

Computes the placement geometry for menus displayed in a separately created window

Public function

void

 

Construct

(
    const FArguments & InArgs
)

Construct this widget

Public function Static

void

 

DismissAllApplicationMenus()

Public function Const

FVector2D

 

GetMenuPosition()

Public function Const

bool

 

HasOpenSubMenus()

Public function Const

bool

 

IsOpen()

Protected function Const

bool

 

IsOpenAndReusingWindow()

Protected function Const

bool

 

IsOpenViaCreatedWindow()

Protected function

void

 

OnMenuClosed

(
    TSharedRef < IMenu > InMenu
)

Handler/callback called by menus created by this anchor, when they are dismissed

Protected function

void

 

ResetPopupMenuContent()

Reset the popup state to prepopup.

Public function

void

 

SetContent

(
    TSharedRef < SWidget > InContent
)

See Content Slot attribute

Public function

void

 

SetFitInWindow

(
    bool bFit
)

Public function Virtual

void

 

SetIsOpen

(
    bool InIsOpen,
    const bool bFocusMenu,
    const int32 FocusUserIndex
)

Open or close the popup

Public function Virtual

void

 

SetMenuContent

(
    TSharedRef < SWidget > InMenuContent
)

See MenuContent attribute

Public function

void

 

SetMenuPlacement

(
    TAttribute < EMenuPlacement > InMenu...
)

Public function Const

bool

 

ShouldOpenDueToClick()

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.

Protected function Virtual Const

bool

 

ComputeVolatility()

Recomputes the volatility of the widget.

Protected function Virtual

FChildren &#...

 

GetChildren()

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

Protected function Virtual Const

void

 

OnArrangeChildren

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

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

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

Protected function Virtual

void

 

Tick

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

Ticks this widget with Geometry.

Overridden from IMenuHost

Classes

Name

Description

Public struct

FArguments

Protected struct

FPopupPlacement

Constants

Name

Description

OpenApplicationMenus

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