Files
UnrealEngineUWP/Engine/Source/Runtime/Slate/Private/Framework/Application/Menu.cpp

106 lines
2.3 KiB
C++
Raw Normal View History

// Copyright Epic Games, Inc. All Rights Reserved.
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3209340 on 2016/11/23 by Ben.Marsh Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h. Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms. * Every header now includes everything it needs to compile. * There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first. * There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h. * Every .cpp file includes its matching .h file first. * This helps validate that each header is including everything it needs to compile. * No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more. * You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there. * There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible. * No engine code explicitly includes a precompiled header any more. * We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies. * PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files. Tool used to generate this transform is at Engine\Source\Programs\IncludeTool. [CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
#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());
}
}
Copying //UE4/Orion-Staging to //UE4/Dev-Main (Source: //UE4/Orion-Staging @ 3134206) #lockdown Nick.Penwarden #rb none #codereview Andrew.Grant ========================== MAJOR FEATURES + CHANGES ========================== Change 2845744 on 2016/01/27 by Andrew.Grant Merging from //Orion/Dev-General @ 2845681 Change 2849210 on 2016/01/29 by Andrew.Grant Merging using //Orion/Dev-General/_To_//UE4/Orion-Stating Change 2854307 on 2016/02/03 by Andrew.Grant Merging using //Orion/Dev-General/_To_//UE4/Orion-Stating Change 2880059 on 2016/02/24 by Andrew.Grant Merging //Orion/Dev-General @ 2879808 Change 2891205 on 2016/03/02 by Andrew.Grant Merging //Orion/Dev-General @ 2889885 Change 2904080 on 2016/03/10 by Andrew.Grant Merging using //Orion/Dev-General @ 2902652 Change 2950235 on 2016/04/20 by Andrew.Grant Automerged files from Dev-General Change 2976227 on 2016/05/12 by Andrew.Grant Autoresolved files from using //Orion/Dev-General Change 3016193 on 2016/06/16 by Andrew.Grant Merging //Orion/Dev-General @ 3015761 Change 3033336 on 2016/06/29 by Andrew.Grant Merging using //Orion/Dev-General/_To_//UE4/Orion-Stating Change 3037514 on 2016/07/05 by Andrew.Grant Merging from //Orion/Dev-General @ 3037465 Change 3091216 on 2016/08/16 by Andrew.Grant Merging using //Orion/Dev-General/_To_//UE4/Orion-Stating Change 3107127 on 2016/08/30 by Andrew.Grant Merging using //Orion/Dev-General/_To_//UE4/Orion-Stating Change 3129090 on 2016/09/16 by Andrew.Grant Autoresolved files from Dev-Gen @ 3130045 Change 3130536 on 2016/09/19 by Andrew.Grant To Resolve Change 3130537 on 2016/09/19 by Andrew.Grant Tricky merges? Change 3130810 on 2016/09/19 by Andrew.Grant Merging from //Orion/Dev-General @ 3130045 Change 3130880 on 2016/09/19 by Andrew.Grant Blueprint fix Change 3131009 on 2016/09/19 by Andrew.Grant removed spammy warning Change 3131216 on 2016/09/19 by Andrew.Grant Content fixes for Orion-Staging Change 3131700 on 2016/09/19 by Andrew.Grant Merging //UE4/Dev-Main to Orion-Staging (//UE4/Orion-Staging) Change 3132144 on 2016/09/20 by Andrew.Grant Merging test framework work from Dev-General Change 3132154 on 2016/09/20 by Andrew.Grant Fix for linux client Change 3132179 on 2016/09/20 by Andrew.Grant Fixed breakages due to latest //UE4/Main Change 3132948 on 2016/09/20 by Andrew.Grant Fix for UE-36216 (replicating 3125764 from ForniteMain) Change 3133103 on 2016/09/20 by Andrew.Grant Added EpicCMSUIFramework and CommonUI to Fortnite plugin Change 3133327 on 2016/09/20 by Andrew.Grant Orion automation improvements Change 3133555 on 2016/09/20 by Andrew.Grant FIx for UE-36226 Change 3133996 on 2016/09/21 by Andrew.Grant REbuilt texture streaming Change 3134204 on 2016/09/21 by Andrew.Grant Merging audio files from Orion with correct compression settings Change 3134205 on 2016/09/21 by Andrew.Grant Fix for gameplay tag ordering from Orion, and fix for soak test report numbers Change 3134206 on 2016/09/21 by Andrew.Grant Merging //UE4/Dev-Main to Orion-Staging (//UE4/Orion-Staging) [CL 3135156 by Marc Audy in Main branch]
2016-09-21 18:16:12 -04:00
bool FMenuInHostWidget::UsingApplicationMenuStack() const
{
TSharedPtr<IMenuHost> HostPinned = MenuHost.Pin();
if (HostPinned.IsValid())
{
return HostPinned->UsingApplicationMenuStack();
}
return true;
}