2016-12-08 08:52:44 -05:00
|
|
|
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
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/MultiBox/SWidgetBlock.h"
|
|
|
|
|
#include "Widgets/SBoxPanel.h"
|
|
|
|
|
#include "Framework/MultiBox/MultiBoxBuilder.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructor
|
|
|
|
|
*
|
|
|
|
|
* @param InHeadingText Heading text
|
|
|
|
|
*/
|
|
|
|
|
FWidgetBlock::FWidgetBlock( TSharedRef<SWidget> InContent, const FText& InLabel, bool bInNoIndent )
|
2014-08-01 02:25:53 -04:00
|
|
|
: FMultiBlock( nullptr, nullptr, NAME_None, EMultiBlockType::Widget )
|
2014-03-14 14:13:41 -04:00
|
|
|
, ContentWidget( InContent )
|
|
|
|
|
, Label( InLabel )
|
|
|
|
|
, bNoIndent( bInNoIndent )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FWidgetBlock::CreateMenuEntry(FMenuBuilder& MenuBuilder) const
|
|
|
|
|
{
|
|
|
|
|
FText EntryLabel = (!Label.IsEmpty()) ? Label : NSLOCTEXT("WidgetBlock", "CustomControl", "Custom Control");
|
|
|
|
|
MenuBuilder.AddWidget(ContentWidget, FText::GetEmpty(), true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Allocates a widget for this type of MultiBlock. Override this in derived classes.
|
|
|
|
|
*
|
|
|
|
|
* @return MultiBlock widget object
|
|
|
|
|
*/
|
|
|
|
|
TSharedRef< class IMultiBlockBaseWidget > FWidgetBlock::ConstructWidget() const
|
|
|
|
|
{
|
|
|
|
|
return SNew( SWidgetBlock )
|
|
|
|
|
.Cursor(EMouseCursor::Default);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Construct this widget
|
|
|
|
|
*
|
|
|
|
|
* @param InArgs The declaration data for this widget
|
|
|
|
|
*/
|
|
|
|
|
void SWidgetBlock::Construct( const FArguments& InArgs )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Builds this MultiBlock widget up from the MultiBlock associated with it
|
|
|
|
|
*/
|
|
|
|
|
void SWidgetBlock::BuildMultiBlockWidget(const ISlateStyle* StyleSet, const FName& StyleName)
|
|
|
|
|
{
|
|
|
|
|
TSharedRef< const FWidgetBlock > WidgetBlock = StaticCastSharedRef< const FWidgetBlock >( MultiBlock.ToSharedRef() );
|
|
|
|
|
|
|
|
|
|
bool bHasLabel = !WidgetBlock->Label.IsEmpty();
|
|
|
|
|
FMargin Padding = WidgetBlock->bNoIndent ? StyleSet->GetMargin( StyleName, ".Block.Padding" ) : StyleSet->GetMargin( StyleName, ".Block.IndentedPadding" );
|
|
|
|
|
|
2015-08-26 10:33:13 -04:00
|
|
|
// Add this widget to the search list of the multibox
|
|
|
|
|
if (MultiBlock->GetSearchable())
|
|
|
|
|
OwnerMultiBoxWidget.Pin()->AddSearchElement(this->AsWidget(), WidgetBlock->Label);
|
|
|
|
|
|
|
|
|
|
// This widget holds the search text, set it as the search block widget
|
|
|
|
|
if (OwnerMultiBoxWidget.Pin()->GetSearchTextWidget() == WidgetBlock->ContentWidget)
|
|
|
|
|
{
|
|
|
|
|
OwnerMultiBoxWidget.Pin()->SetSearchBlockWidget(this->AsWidget());
|
|
|
|
|
this->AsWidget()->SetVisibility(EVisibility::Collapsed);
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
ChildSlot
|
|
|
|
|
.Padding( Padding ) // Large left margin mimics the indent of normal menu items when bNoIndent is false
|
|
|
|
|
[
|
|
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
[
|
|
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
.Visibility( bHasLabel ? EVisibility::Visible : EVisibility::Collapsed )
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
.Padding(0.f, 0.f, 4.f, 0.f)
|
|
|
|
|
.VAlign( VAlign_Center )
|
|
|
|
|
[
|
|
|
|
|
SNew( STextBlock )
|
|
|
|
|
.TextStyle( StyleSet, ISlateStyle::Join( StyleName, ".Label" ) )
|
|
|
|
|
.Text( WidgetBlock->Label )
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
+SHorizontalBox::Slot()
|
|
|
|
|
.VAlign( VAlign_Bottom )
|
|
|
|
|
.FillWidth(1.f)
|
|
|
|
|
[
|
|
|
|
|
WidgetBlock->ContentWidget
|
|
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
}
|