UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MenuStack.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
8#include "Layout/SlateRect.h"
9#include "Widgets/SWidget.h"
10#include "Types/SlateStructs.h"
11#include "Widgets/SWindow.h"
14
15class FWidgetPath;
16class SMenuPanel;
17class FMenuBase;
18
20
21#if UE_BUILD_DEBUG
22 // Debugging is harder with the inline allocator
24#else
26#endif
27
28
61
63
64#if WITH_SLATE_DEBUGGING
66#endif
67
73{
74public:
77 : bHostWindowGuard(false)
78 {}
79
96
111 TSharedRef<IMenu> 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);
112
125 TSharedRef<IMenu> PushHosted(const FWidgetPath& InOwnerPath, const TSharedRef<IMenuHost>& InMenuHost, const TSharedRef<SWidget>& InContent, TSharedPtr<SWidget>& OutWrappedContent, const FPopupTransitionEffect& TransitionEffect, EShouldThrottle ShouldThrottle, const bool bIsCollapsedByParent = true);
126
139
147
151 void DismissAll();
152
159
166
176
185
195
200
205
209 bool HasMenus() const;
210
215
217 FOnMenuDestroyed& OnMenuDestroyedEvent() { return MenuDestroyedEvent; }
218
219private:
227 FPopupMethodReply QueryPopupMethod(const FWidgetPath& PathToQuery);
228
234 void DismissInternal(int32 FirstStackIndexToRemove);
235
239 void SetHostPath(const FWidgetPath& InOwnerPath);
240
246 void OnMenuDestroyed(TSharedRef<IMenu> InMenu);
247
253 void OnMenuContentLostFocus(const FWidgetPath& InFocussedPath);
254
264
266 struct FPrePushArgs
267 {
268 FPrePushArgs() : TransitionEffect(FPopupTransitionEffect::None) {}
269
271 FSlateRect Anchor;
272 FPopupTransitionEffect TransitionEffect;
273 int32 FocusUserIndex = INDEX_NONE;
274 bool bFocusImmediately;
275 bool bIsCollapsedByParent;
276 };
277
279 struct FPrePushResults
280 {
281 TSharedPtr<SWidget> WrappedContent;
282 TSharedPtr<SWidget> WidgetToFocus;
283 FVector2f AnimStartLocation;
284 FVector2f AnimFinalLocation;
285 bool bAnchorSetsMinWidth;
286 FVector2f ExpectedSize;
287 bool bAllowAnimations;
288 bool bFocusImmediately;
289 bool bIsCollapsedByParent;
290 };
291
300 FPrePushResults PrePush(const FPrePushArgs& InArgs);
301
316 TSharedRef<IMenu> PushInternal(const TSharedPtr<IMenu>& InParentMenu, const TSharedRef<SWidget>& InContent, FSlateRect Anchor, const FPopupTransitionEffect& TransitionEffect, const bool bFocusImmediately, EShouldThrottle ShouldThrottle, const bool bIsCollapsedByParent, const bool bEnablePerPixelTransparency, const int32 FocusUserIndex = INDEX_NONE);
317
328 TSharedRef<FMenuBase> PushNewWindow(TSharedPtr<IMenu> InParentMenu, const FPrePushResults& InPrePushResults, const bool bEnablePerPixelTransparency, const int32 FocusUserIndex = INDEX_NONE);
329
340 TSharedRef<FMenuBase> PushPopup(TSharedPtr<IMenu> InParentMenu, const FPrePushResults& InPrePushResults, const int32 FocusUserIndex = INDEX_NONE);
341
352
354 FPopupMethodReply ActiveMethod;
355
357 TSharedPtr<SWindow> HostWindow;
358
360 TWeakPtr<SWidget> HostWidget;
361
363 TSharedPtr<SMenuPanel> HostWindowPopupPanel;
364
366 TSharedPtr<FPopupLayer> HostPopupLayer;
367
370
373
375 FThrottleRequest ThrottleHandle;
376
378 TSharedPtr<SWindow> PendingNewWindow;
379
381 TSharedPtr<class FMenuBase> PendingNewMenu;
382
384 bool bHostWindowGuard;
385
387 FOnMenuDestroyed MenuDestroyedEvent;
388};
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type)
Definition DelegateCombinations.h:49
TArray< TSharedPtr< IMenu >, TInlineAllocator< 4 > > FMenuList
Definition MenuStack.h:25
TArray< TSharedPtr< SWindow > > FMenuWindowList
Definition MenuStack.h:19
EShouldThrottle
Definition PopupMethodReply.h:17
Definition IConsoleManager.h:1471
Definition Menu.h:16
Definition MenuStack.h:73
TSharedPtr< IMenu > FindMenuInWidgetPath(const FWidgetPath &PathToQuery) const
Definition MenuStack.cpp:809
void DismissAll()
Definition MenuStack.cpp:661
bool GetToolTipForceFieldRect(const TSharedRef< IMenu > &InMenu, const FWidgetPath &InPathContainingMenu, FSlateRect &OutSlateRect) const
Definition MenuStack.cpp:892
TSharedPtr< SWindow > GetHostWindow() const
Definition MenuStack.cpp:945
void DismissFrom(const TSharedPtr< IMenu > &InFromMenu)
Definition MenuStack.cpp:652
TSharedRef< IMenu > 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)
Definition MenuStack.cpp:215
bool HasMenus() const
Definition MenuStack.cpp:934
TSharedPtr< IMenu > FindMenuFromWindow(TSharedRef< SWindow > InWindow) const
Definition MenuStack.cpp:882
FMenuStack()
Definition MenuStack.h:76
TSharedPtr< SWidget > GetHostWidget() const
Definition MenuStack.cpp:950
TSharedRef< IMenu > PushHosted(const FWidgetPath &InOwnerPath, const TSharedRef< IMenuHost > &InMenuHost, const TSharedRef< SWidget > &InContent, TSharedPtr< SWidget > &OutWrappedContent, const FPopupTransitionEffect &TransitionEffect, EShouldThrottle ShouldThrottle, const bool bIsCollapsedByParent=true)
Definition MenuStack.cpp:285
bool HasOpenSubMenus(TSharedPtr< IMenu > InMenu) const
Definition MenuStack.cpp:939
FOnMenuDestroyed & OnMenuDestroyedEvent()
Definition MenuStack.h:217
void OnWindowActivated(TSharedRef< SWindow > ActivatedWindow)
Definition MenuStack.cpp:846
void OnWindowDestroyed(TSharedRef< SWindow > InWindow)
Definition MenuStack.cpp:823
Definition PopupMethodReply.h:24
Definition SlateRect.h:26
Definition ThrottleManager.h:14
Definition WidgetPath.h:51
Definition MenuStack.cpp:33
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition SharedPointer.h:692
Definition SharedPointer.h:153
Definition ContainerAllocationPolicies.h:894
Definition SharedPointer.h:1295
@ false
Definition radaudio_common.h:23
Definition SlateStructs.h:13
Definition MenuStack.h:31
enum FPopupTransitionEffect::ESlideDirection SlideDirection
FPopupTransitionEffect(const ESlideDirection InitSlideDirection)
Definition MenuStack.h:57
ESlideDirection
Definition MenuStack.h:34
@ TypeInPopup
Definition MenuStack.h:48
@ SubMenu
Definition MenuStack.h:45
@ None
Definition MenuStack.h:36
@ TopMenu
Definition MenuStack.h:42
@ ContextMenu
Definition MenuStack.h:51
@ ComboButton
Definition MenuStack.h:39
Definition Optional.h:131
static CORE_API const TVector2< float > ZeroVector
Definition Vector2D.h:63
Definition SlateVector2.h:485