UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FMenuStack Class Reference

#include <MenuStack.h>

Public Member Functions

 FMenuStack ()
 
TSharedRef< IMenuPush (const FWidgetPath &InOwnerPath, const TSharedRef< SWidget > &InContent, const UE::Slate::FDeprecateVector2DParameter &SummonLocation, const FPopupTransitionEffect &TransitionEffect, const bool bFocusImmediately=true, const UE::Slate::FDeprecateVector2DParameter &SummonLocationSize=FVector2f::ZeroVector, TOptional< EPopupMethod > InMethod=TOptional< EPopupMethod >(), const bool bIsCollapsedByParent=true, const bool bEnablePerPixelTransparency=false, const int32 FocusUserIndex=INDEX_NONE)
 
TSharedRef< IMenuPush (const TSharedPtr< IMenu > &InParentMenu, const TSharedRef< SWidget > &InContent, const UE::Slate::FDeprecateVector2DParameter &SummonLocation, const FPopupTransitionEffect &TransitionEffect, const bool bFocusImmediately=true, const UE::Slate::FDeprecateVector2DParameter &SummonLocationSize=FVector2f::ZeroVector, const bool bIsCollapsedByParent=true, const bool bEnablePerPixelTransparency=false, const int32 FocusUserIndex=INDEX_NONE)
 
TSharedRef< IMenuPushHosted (const FWidgetPath &InOwnerPath, const TSharedRef< IMenuHost > &InMenuHost, const TSharedRef< SWidget > &InContent, TSharedPtr< SWidget > &OutWrappedContent, const FPopupTransitionEffect &TransitionEffect, EShouldThrottle ShouldThrottle, const bool bIsCollapsedByParent=true)
 
TSharedRef< IMenuPushHosted (const TSharedPtr< IMenu > &InParentMenu, const TSharedRef< IMenuHost > &InMenuHost, const TSharedRef< SWidget > &InContent, TSharedPtr< SWidget > &OutWrappedContent, const FPopupTransitionEffect &TransitionEffect, EShouldThrottle ShouldThrottle, const bool bIsCollapsedByParent=true)
 
void DismissFrom (const TSharedPtr< IMenu > &InFromMenu)
 
void DismissAll ()
 
void OnWindowDestroyed (TSharedRef< SWindow > InWindow)
 
void OnWindowActivated (TSharedRef< SWindow > ActivatedWindow)
 
TSharedPtr< IMenuFindMenuFromWindow (TSharedRef< SWindow > InWindow) const
 
TSharedPtr< IMenuFindMenuInWidgetPath (const FWidgetPath &PathToQuery) const
 
bool GetToolTipForceFieldRect (const TSharedRef< IMenu > &InMenu, const FWidgetPath &InPathContainingMenu, FSlateRect &OutSlateRect) const
 
TSharedPtr< SWindowGetHostWindow () const
 
TSharedPtr< SWidgetGetHostWidget () const
 
bool HasMenus () const
 
bool HasOpenSubMenus (TSharedPtr< IMenu > InMenu) const
 
FOnMenuDestroyedOnMenuDestroyedEvent ()
 

Detailed Description

Represents a stack of open menus. The last item in the stack is the top most menu Menus are described as IMenus. Implementations of IMenu can control how the menus are created and presented (e.g. in their own window)

Constructor & Destructor Documentation

◆ FMenuStack()

FMenuStack::FMenuStack ( )
inline

Constructor

Member Function Documentation

◆ DismissAll()

void FMenuStack::DismissAll ( )

Dismisses the entire menu stack

◆ DismissFrom()

void FMenuStack::DismissFrom ( const TSharedPtr< IMenu > &  InFromMenu)

Dismisses the menu stack including InFromMenu and all its child menus Dismisses in reverse order (children first)

Parameters
InFromMenuThe menu to remove along with its children

◆ FindMenuFromWindow()

TSharedPtr< IMenu > FMenuStack::FindMenuFromWindow ( TSharedRef< SWindow InWindow) const

Finds a menu in the stack that owns InWindow. Although this method isn't deprecated, it is intended for private use inside FMenuStack and its use as a public method should be avoided. Menus should be identified in client code as IMenu interfaces.

Parameters
InWindowThe window to look for
Returns
The menu in the stack that owns InWindow, or an invalid ptr if not found

◆ FindMenuInWidgetPath()

TSharedPtr< IMenu > FMenuStack::FindMenuInWidgetPath ( const FWidgetPath PathToQuery) const

Searches from bottom to top of the widget path for a menu in the stack. If the widget at the end of PathToQuery is inside a menu, there will be a menu content wrapper widget in the path.

Parameters
PathToQueryThe widget path to search for a menu
Returns
The menu in the stack that contains the widget at the end of PathToQuery, or an invalid ptr if not found

◆ GetHostWidget()

TSharedPtr< SWidget > FMenuStack::GetHostWidget ( ) const
Returns
Returns the widget that is the parent widget that initially created the menu in the stack

◆ GetHostWindow()

TSharedPtr< SWindow > FMenuStack::GetHostWindow ( ) const
Returns
Returns the window that is the parent of everything in the stack, if any. If the stack is empty, returns an invalid ptr.

◆ GetToolTipForceFieldRect()

bool FMenuStack::GetToolTipForceFieldRect ( const TSharedRef< IMenu > &  InMenu,
const FWidgetPath InPathContainingMenu,
FSlateRect OutSlateRect 
) const

Called by the application when showing tooltips. It prevents tooltips from drawing over menu items. If the resulting bool is false, the resulting OutSlateRect will be [0,0,0,0] and should not be used.

Parameters
InMenuA menu in the stack, used to generate the force field rect
InPathContainingMenuA widget path containing InMenu. This could be generated but the application has the path so it helps performance to pass it in here.
OutSlateRectThe output rectangle enclosing the menu's children (created from the clipping rects in the geometry in PathContainingMenu)
Returns
A bool indicating whether a solution was found. If false, the resulting OutSlateRect will be [0,0,0,0] and should not be used.

◆ HasMenus()

bool FMenuStack::HasMenus ( ) const
Returns
True if the stack has one or more menus in it, false if it is empty.

◆ HasOpenSubMenus()

bool FMenuStack::HasOpenSubMenus ( TSharedPtr< IMenu InMenu) const
Returns
Returns whether the menu has child menus. If the menu isn't in the stack, returns false.

◆ OnMenuDestroyedEvent()

FOnMenuDestroyed & FMenuStack::OnMenuDestroyedEvent ( )
inline

Delegate called when a menu is dismissed and destroyed

◆ OnWindowActivated()

void FMenuStack::OnWindowActivated ( TSharedRef< SWindow ActivatedWindow)

Notifies the stack that a new window was activated. The menu stack will be dismissed if the activated window is not a menu in the stack

Parameters
ActivatedWindowThe window that was just activated

◆ OnWindowDestroyed()

void FMenuStack::OnWindowDestroyed ( TSharedRef< SWindow InWindow)

Called by the application when any window is destroyed.

Parameters
InWindowThe window that was destroyed

◆ Push() [1/2]

TSharedRef< IMenu > FMenuStack::Push ( const FWidgetPath InOwnerPath,
const TSharedRef< SWidget > &  InContent,
const UE::Slate::FDeprecateVector2DParameter SummonLocation,
const FPopupTransitionEffect TransitionEffect,
const bool  bFocusImmediately = true,
const UE::Slate::FDeprecateVector2DParameter SummonLocationSize = FVector2f::ZeroVector,
TOptional< EPopupMethod InMethod = TOptional<EPopupMethod>(),
const bool  bIsCollapsedByParent = true,
const bool  bEnablePerPixelTransparency = false,
const int32  FocusUserIndex = INDEX_NONE 
)

Pushes a new menu onto the stack. The widget path will be searched for existing menus and the new menu will be parented appropriately. Menus are always auto-sized. Use fixed-size content if a fixed size is required.

Parameters
InOwnerPathThe widget path for the parent widget of this menu.
InContentThe menu's content
SummonLocationLocation in screen-space where the menu should appear
TransitionEffectAnimation to use when the popup appears
bFocusImmediatelyShould the popup steal focus when shown?
SummonLocationSizeAn optional size around the summon location which describes an area in which the menu may not appear
InMethodAn optional popup method that will override the default method for the widgets in InOwnerPath
bIsCollapsedByParentIs this menu collapsed when a parent menu receives focus/activation? If false, only focus/activation outside the entire stack will auto collapse it.
bEnablePerPixelTransparencyDoes the menu's content require per pixel transparency?
FocusUserIndexThe index of the user that should focus the menu. INDEX_NONE for all users.

◆ Push() [2/2]

TSharedRef< IMenu > FMenuStack::Push ( const TSharedPtr< IMenu > &  InParentMenu,
const TSharedRef< SWidget > &  InContent,
const UE::Slate::FDeprecateVector2DParameter SummonLocation,
const FPopupTransitionEffect TransitionEffect,
const bool  bFocusImmediately = true,
const UE::Slate::FDeprecateVector2DParameter SummonLocationSize = FVector2f::ZeroVector,
const bool  bIsCollapsedByParent = true,
const bool  bEnablePerPixelTransparency = false,
const int32  FocusUserIndex = INDEX_NONE 
)

Pushes a new child menu onto the stack. Menus are always auto-sized. Use fixed-size content if a fixed size is required.

Parameters
InParentMenuThe parent menu for this menu
InContentThe menu's content
SummonLocationLocation in screen-space where the menu should appear
TransitionEffectAnimation to use when the popup appears
bFocusImmediatelyShould the popup steal focus when shown?
SummonLocationSizeAn optional size around the summon location which describes an area in which the menu may not appear
bIsCollapsedByParentIs this menu collapsed when a parent menu receives focus/activation? If false, only focus/activation outside the entire stack will auto collapse it.
bEnablePerPixelTransparencyDoes the menu's content require per pixel transparency?
FocusUserIndexThe index of the user that should focus the menu. INDEX_NONE for all users.

◆ PushHosted() [1/2]

TSharedRef< IMenu > FMenuStack::PushHosted ( const FWidgetPath InOwnerPath,
const TSharedRef< IMenuHost > &  InMenuHost,
const TSharedRef< SWidget > &  InContent,
TSharedPtr< SWidget > &  OutWrappedContent,
const FPopupTransitionEffect TransitionEffect,
EShouldThrottle  ShouldThrottle,
const bool  bIsCollapsedByParent = true 
)

Pushes a new menu onto the stack that is drawn by an external host widget. The widget path will be searched for existing menus and the new menu will be parented appropriately. Menus are always auto-sized. Use fixed-size content if a fixed size is required.

Parameters
InOwnerPathThe widget path for the parent widget of this menu
InMenuHostThe host widget that draws the menu's content
InContentThe menu's content
OutWrappedContentReturns the InContent wrapped with widgets needed by the menu stack system. This is what should be drawn by the host after this call.
TransitionEffectAnimation to use when the popup appears
bIsCollapsedByParentIs this menu collapsed when a parent menu receives focus/activation? If false, only focus/activation outside the entire stack will auto collapse it.

◆ PushHosted() [2/2]

TSharedRef< IMenu > FMenuStack::PushHosted ( const TSharedPtr< IMenu > &  InParentMenu,
const TSharedRef< IMenuHost > &  InMenuHost,
const TSharedRef< SWidget > &  InContent,
TSharedPtr< SWidget > &  OutWrappedContent,
const FPopupTransitionEffect TransitionEffect,
EShouldThrottle  ShouldThrottle,
const bool  bIsCollapsedByParent = true 
)

Pushes a new child menu onto the stack that is drawn by an external host widget. Menus are always auto-sized. Use fixed-size content if a fixed size is required.

Parameters
InParentMenuThe parent menu for this menu
InMenuHostThe host widget that draws the menu's content
InContentThe menu's content
OutWrappedContentReturns the InContent wrapped with widgets needed by the menu stack system. This is what should be drawn by the host after this call.
TransitionEffectAnimation to use when the popup appears
bIsCollapsedByParentIs this menu collapsed when a parent menu receives focus/activation? If false, only focus/activation outside the entire stack will auto collapse it.

The documentation for this class was generated from the following files: