You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rnx #rb none #ROBOMERGE-OWNER: ryan.durand #ROBOMERGE-AUTHOR: ryan.durand #ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900 #ROBOMERGE-BOT: (v613-10869866) [CL 10870549 by ryan durand in Main branch]
106 lines
2.3 KiB
C++
106 lines
2.3 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Framework/Application/Menu.h"
|
|
#include "Widgets/SWidget.h"
|
|
#include "Widgets/SWindow.h"
|
|
#include "Framework/Application/SlateApplication.h"
|
|
|
|
FMenuBase::FMenuBase(TSharedRef<SWidget> InContent, const bool bCollapsedByParent)
|
|
: Content(InContent)
|
|
, bDismissing(false)
|
|
, bIsCollapsedByParent(bCollapsedByParent)
|
|
{
|
|
}
|
|
|
|
FMenuInWindow::FMenuInWindow(TSharedRef<SWindow> InWindow, TSharedRef<SWidget> InContent, const bool bIsCollapsedByParent)
|
|
: FMenuBase(InContent, bIsCollapsedByParent)
|
|
, Window(InWindow)
|
|
{
|
|
}
|
|
|
|
TSharedPtr<SWindow> FMenuInWindow::GetParentWindow() const
|
|
{
|
|
// Return the menu's window
|
|
return Window.Pin();
|
|
}
|
|
|
|
void FMenuInWindow::Dismiss()
|
|
{
|
|
if (!bDismissing)
|
|
{
|
|
bDismissing = true;
|
|
OnMenuDismissed.Broadcast(AsShared());
|
|
|
|
// Close the window
|
|
// Will cause the window destroy code to call back into the stack to clean up
|
|
TSharedPtr<SWindow> WindowPinned = Window.Pin();
|
|
if (WindowPinned.IsValid())
|
|
{
|
|
WindowPinned->RequestDestroyWindow();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
FMenuInPopup::FMenuInPopup(TSharedRef<SWidget> InContent, const bool bIsCollapsedByParent)
|
|
: FMenuBase(InContent, bIsCollapsedByParent)
|
|
{
|
|
}
|
|
|
|
TSharedPtr<SWindow> FMenuInPopup::GetParentWindow() const
|
|
{
|
|
// Return the menu's window
|
|
return FSlateApplication::Get().GetVisibleMenuWindow();
|
|
}
|
|
|
|
void FMenuInPopup::Dismiss()
|
|
{
|
|
if (!bDismissing)
|
|
{
|
|
bDismissing = true;
|
|
OnMenuDismissed.Broadcast(AsShared());
|
|
}
|
|
}
|
|
|
|
|
|
FMenuInHostWidget::FMenuInHostWidget(TSharedRef<IMenuHost> InHost, const TSharedRef<SWidget>& InContent, const bool bIsCollapsedByParent)
|
|
: FMenuBase(InContent, bIsCollapsedByParent)
|
|
, MenuHost(InHost)
|
|
{
|
|
}
|
|
|
|
TSharedPtr<SWindow> FMenuInHostWidget::GetParentWindow() const
|
|
{
|
|
// Return the menu's window
|
|
TSharedPtr<IMenuHost> HostPinned = MenuHost.Pin();
|
|
if (HostPinned.IsValid())
|
|
{
|
|
return HostPinned->GetMenuWindow();
|
|
}
|
|
return TSharedPtr<SWindow>();
|
|
}
|
|
|
|
void FMenuInHostWidget::Dismiss()
|
|
{
|
|
if (!bDismissing)
|
|
{
|
|
bDismissing = true;
|
|
TSharedPtr<IMenuHost> HostPinned = MenuHost.Pin();
|
|
if (HostPinned.IsValid())
|
|
{
|
|
HostPinned->OnMenuDismissed();
|
|
}
|
|
OnMenuDismissed.Broadcast(AsShared());
|
|
}
|
|
}
|
|
|
|
bool FMenuInHostWidget::UsingApplicationMenuStack() const
|
|
{
|
|
TSharedPtr<IMenuHost> HostPinned = MenuHost.Pin();
|
|
if (HostPinned.IsValid())
|
|
{
|
|
return HostPinned->UsingApplicationMenuStack();
|
|
}
|
|
return true;
|
|
}
|